From 8ae69b7419beb09993e82f2c81a0affc8b24160a Mon Sep 17 00:00:00 2001 From: Tunahan Cicek Date: Fri, 22 Nov 2024 08:59:33 +0100 Subject: [PATCH] Integrate dynamic integrationtests --- CHANGELOG.md | 1 + ...setAdministrationShellIntegrationTest.java | 161 +++ .../integrationtests/ResponseValidator.java | 72 + .../integrationtests/model/ApiRequest.java | 33 + .../integrationtests/model/Assertion.java | 38 + .../model/ExpectedResponse.java | 35 + .../AssetAdministrationShellApiTest.java | 1242 ----------------- .../semantics/registry/JwtTokenFactory.java | 13 + .../1_delete_shell/expected-response.json | 6 + .../1_delete_shell/request.json | 6 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../1_post_shell/expected-response.json | 25 + .../1_post_shell/request.json | 21 + .../expected-response.json | 15 + .../2_update_specific_asset_ids/request.json | 15 + .../3_get_shell_by_id/expected-response.json | 33 + .../3_get_shell_by_id/request.json | 6 + .../expected-response.json | 11 + .../1_update_specific_asset_ids/request.json | 11 + .../expected-response.json | 11 + .../1_get_specific_asset_ids/request.json | 6 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../expected-response.json | 42 + .../2_post_submodel_descriptors/request.json | 42 + .../expected-response.json | 15 + .../3_get_shell_descriptors/request.json | 6 + .../1_post_shell/expected-response.json | 61 + .../1_post_shell/request.json | 61 + .../expected-response.json | 11 + .../2_post_submodel_descriptors/request.json | 42 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../expected-response.json | 42 + .../2_post_submodel_descriptors/request.json | 42 + .../expected-response.json | 6 + .../3_put_submodel_descriptors/request.json | 47 + .../expected-response.json | 71 + .../4_get_shell_descriptors/request.json | 6 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../expected-response.json | 42 + .../2_post_submodel_descriptors/request.json | 42 + .../expected-response.json | 64 + .../3_get_shell_descriptors/request.json | 6 + .../expected-response.json | 10 + .../4_put_submodel_descriptors/request.json | 47 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../expected-response.json | 42 + .../2_post_submodel_descriptors/request.json | 42 + .../expected-response.json | 6 + .../3_put_submodel_descriptors/request.json | 47 + .../expected-response.json | 71 + .../4_get_shell_descriptors/request.json | 6 + .../1_post_shell/expected-response.json | 160 +++ .../1_post_shell/request.json | 160 +++ .../2_get_shells/expected-response.json | 10 + .../2_get_shells/request.json | 6 + .../3_get_shell_by_id/expected-response.json | 160 +++ .../3_get_shell_by_id/request.json | 6 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../expected-response.json | 42 + .../2_post_submodel_descriptors/request.json | 42 + .../expected-response.json | 15 + .../3_get_shell_descriptors/request.json | 6 + .../expected-response.json | 6 + .../4_delete_shell_descriptors/request.json | 6 + .../expected-response.json | 11 + .../5_get_shell_descriptors/request.json | 6 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../expected-response.json | 42 + .../2_post_submodel_descriptors/request.json | 42 + .../expected-response.json | 9 + .../3_delete_shell_descriptors/request.json | 6 + .../expected-response.json | 9 + .../1_get_lookup_shells/request.json | 6 + .../expected-response.json | 9 + .../1_get_lookup_shells/request.json | 6 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../2_post_shell/expected-response.json | 21 + .../2_post_shell/request.json | 21 + .../expected-response.json | 15 + .../3_get_lookup_shells/request.json | 6 + .../expected-response.json | 23 + .../4_get_lookup_shells/request.json | 6 + .../1_post_shell/expected-response.json | 21 + .../1_post_shell/request.json | 21 + .../2_post_shell/expected-response.json | 21 + .../2_post_shell/request.json | 21 + .../expected-response.json | 15 + .../3_post_lookup_shells/request.json | 11 + .../expected-response.json | 23 + .../4_post_lookup_shells/request.json | 11 + .../1_post_shell/expected-response.json | 13 + .../1_post_shell/request.json | 13 + .../expected-response.json | 19 + .../2_get_lookup_shells/request.json | 6 + .../1_post_shell/expected-response.json | 13 + .../1_post_shell/request.json | 13 + .../expected-response.json | 19 + .../2_post_lookup_shells/request.json | 11 + .../expected-response.json | 6 + .../1_get_lookup_shells/request.json | 6 + .../1_post_shell/expected-response.json | 49 + .../1_post_shell/request.json | 51 + .../2_get_shell_by_id/expected-response.json | 49 + .../2_get_shell_by_id/request.json | 6 + .../1_post_shell/expected-response.json | 10 + .../1_post_shell/request.json | 160 +++ .../1_post_shell/expected-response.json | 50 + .../1_post_shell/request.json | 51 + .../2_get_shell_by_id/expected-response.json | 50 + .../2_get_shell_by_id/request.json | 6 + .../1_post_shell/expected-response.json | 50 + .../1_post_shell/request.json | 51 + .../2_get_shell_by_id/expected-response.json | 50 + .../2_get_shell_by_id/request.json | 6 + .../1_post_shell/expected-response.json | 12 + .../1_post_shell/request.json | 12 + .../2_post_shell/expected-response.json | 9 + .../2_post_shell/request.json | 12 + .../1_post_shell/expected-response.json | 9 + .../1_post_shell/request.json | 88 ++ .../1_post_shell/expected-response.json | 51 + .../1_post_shell/request.json | 51 + .../expected-response.json | 42 + .../2_post_submodel_descriptors/request.json | 42 + .../3_get_shell_by_id/expected-response.json | 88 ++ .../3_get_shell_by_id/request.json | 6 + .../1_post_shell/expected-response.json | 51 + .../1_post_shell/request.json | 51 + .../expected-response.json | 9 + .../2_post_submodel_descriptors/request.json | 42 + .../1_get_description/expected-response.json | 11 + .../1_get_description/request.json | 6 + .../1_post_shell/expected-response.json | 10 + .../1_post_shell/request.json | 160 +++ .../1_post_shell/expected-response.json | 160 +++ .../1_post_shell/request.json | 160 +++ .../2_get_shell_by_id/expected-response.json | 160 +++ .../2_get_shell_by_id/request.json | 6 + .../1_get_shell_by_id/expected-response.json | 5 + .../1_get_shell_by_id/request.json | 6 + .../1_post_shell/expected-response.json | 160 +++ .../1_post_shell/request.json | 160 +++ .../2_update_shell/expected-response.json | 6 + .../2_update_shell/request.json | 160 +++ .../3_get_shell_by_id/expected-response.json | 10 + .../3_get_shell_by_id/request.json | 6 + .../expected-response.json | 10 + .../1_update_shell_by_id/request.json | 160 +++ .../1_post_shell/expected-response.json | 60 + .../1_post_shell/request.json | 60 + .../2_update_shell/expected-response.json | 6 + .../2_update_shell/request.json | 60 + .../3_get_shell_by_id/expected-response.json | 14 + .../3_get_shell_by_id/request.json | 6 + .../1_post_shell/expected-response.json | 25 + .../1_post_shell/request.json | 21 + .../2_delete_shell/expected-response.json | 6 + .../2_delete_shell/request.json | 6 + .../shell-descriptors-req-template.json | 37 + .../shell-with-min-req-template.json | 55 + .../development/guideline-integrationtests.md | 179 +++ 169 files changed, 5999 insertions(+), 1242 deletions(-) create mode 100644 backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/AssetAdministrationShellIntegrationTest.java create mode 100644 backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/ResponseValidator.java create mode 100644 backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ApiRequest.java create mode 100644 backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/Assertion.java create mode 100644 backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ExpectedResponse.java delete mode 100644 backend/src/test/java/org/eclipse/tractusx/semantics/registry/AssetAdministrationShellApiTest.java create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/expected-response.json create mode 100644 backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/request.json create mode 100644 backend/src/test/resources/integrationtests/shell-descriptors-req-template.json create mode 100644 backend/src/test/resources/integrationtests/shell-with-min-req-template.json create mode 100755 docs/development/guideline-integrationtests.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 8be18a52..687ceba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 0.7.0 ### Added +- Add dynamic integration tests ## fixed - Bugfix: [Updated AccessRule Not Applied: Old BPN Retains Access, New BPN Denied](https://github.com/eclipse-tractusx/sldt-digital-twin-registry/issues/489) diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/AssetAdministrationShellIntegrationTest.java b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/AssetAdministrationShellIntegrationTest.java new file mode 100644 index 00000000..a8c26e3d --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/AssetAdministrationShellIntegrationTest.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) 2025 Robert Bosch Manufacturing Solutions GmbH and others + * Copyright (c) 2025 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.semantics.integrationtests; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Stream; + +import org.eclipse.tractusx.semantics.RegistryProperties; +import org.eclipse.tractusx.semantics.integrationtests.model.ApiRequest; +import org.eclipse.tractusx.semantics.integrationtests.model.ExpectedResponse; +import org.eclipse.tractusx.semantics.registry.JwtTokenFactory; +import org.junit.jupiter.api.DynamicTest; +import org.junit.jupiter.api.TestFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@SpringBootTest +@AutoConfigureMockMvc +@EnableConfigurationProperties( RegistryProperties.class ) +public class AssetAdministrationShellIntegrationTest { + + @Autowired + private MockMvc mockMvc; + + @Autowired + protected JwtTokenFactory jwtTokenFactory; + + private final ResponseValidator responseValidator = new ResponseValidator(); + + private final ObjectMapper objectMapper = new ObjectMapper(); + private static final String ROOT_DIR = "src/test/resources/integrationtests/"; + private static final List LIST_OF_TEST_CASES_DIR = List.of( "aas-registry-usecases" ); + private static final String REQUEST_FILE_NAME = "request.json"; + private static final String EXPECTED_RESPONSE_FILE_NAME = "expected-response.json"; + protected static final String EXTERNAL_SUBJECT_ID_HEADER = "Edc-Bpn"; + + @TestFactory + List executeTests() { + + List dynamicTests = new ArrayList<>(); + + LIST_OF_TEST_CASES_DIR.forEach( testcasePath -> { + try { + Stream tests = Files.list( Paths.get( ROOT_DIR + testcasePath ) ) + .filter( Files::isDirectory ) + .map( useCasePath -> { + try { + return DynamicTest.dynamicTest( testcasePath + "_" + useCasePath.getFileName().toString(), + () -> executeUseCaseTest( useCasePath ) ); + } catch ( Exception e ) { + throw new RuntimeException( "Failed to load usecase:" + useCasePath, e ); + } + } ); + + dynamicTests.addAll( tests.toList() ); + } catch ( IOException e ) { + throw new RuntimeException( "Failed to load test steps", e ); + } + } ); + + return dynamicTests; + } + + private void executeUseCaseTest( Path useCasePath ) throws Exception { + Files.list( useCasePath ) + .filter( Files::isDirectory ) + .sorted( Comparator.comparing( Path::getFileName ) ) + .forEach( testStepPath -> { + try { + executeTestStep( testStepPath ); + } catch ( Exception e ) { + throw new RuntimeException( "Failed to load test steps", e ); + } + } ); + } + + private void executeTestStep( Path testStepPath ) throws Exception { + // Load request.json + File requestFile = testStepPath.resolve( REQUEST_FILE_NAME ).toFile(); + ApiRequest request = objectMapper.readValue( requestFile, ApiRequest.class ); + + // Load expected-response.json + File expectedResponseFile = testStepPath.resolve( EXPECTED_RESPONSE_FILE_NAME ).toFile(); + ExpectedResponse expectedResponse = objectMapper.readValue( expectedResponseFile, ExpectedResponse.class ); + + // Perform request + ResultActions actual = performRequest( request ); + + // Validate response + responseValidator.validateResponse( actual, expectedResponse ); + } + + private ResultActions performRequest( ApiRequest request ) throws Exception { + HttpMethod httpMethod = HttpMethod.valueOf( request.getMethod().toUpperCase() ); + MockHttpServletRequestBuilder requestBuilder = createRequestBuilder( httpMethod, request ); + JwtTokenFactory.Tenant tenant = jwtTokenFactory.getTenant( request.getTenant() ); + return mockMvc.perform( + requestBuilder + .header( EXTERNAL_SUBJECT_ID_HEADER, tenant.getTenantId() ) + .accept( MediaType.APPLICATION_JSON ) + .with( tenant.allRoles() ) + ); + } + + private MockHttpServletRequestBuilder createRequestBuilder( HttpMethod httpMethod, ApiRequest request ) throws JsonProcessingException { + String requestUrl = request.getUrl(); + switch ( httpMethod.name() ) { + case "GET": + return get( requestUrl ); + case "POST": + return post( requestUrl ) + .contentType( MediaType.APPLICATION_JSON ) + .content( objectMapper.writeValueAsString( request.getBody() ) ); + case "PUT": + return put( requestUrl ) + .contentType( MediaType.APPLICATION_JSON ) + .content( objectMapper.writeValueAsString( request.getBody() ) ); + case "DELETE": + return delete( requestUrl ); + default: + throw new UnsupportedOperationException( "HTTP method not supported: " + request.getMethod() ); + } + } +} diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/ResponseValidator.java b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/ResponseValidator.java new file mode 100644 index 00000000..66f35c6a --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/ResponseValidator.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH and others + * Copyright (c) 2024 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.semantics.integrationtests; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import java.util.List; + +import org.eclipse.tractusx.semantics.integrationtests.model.Assertion; +import org.eclipse.tractusx.semantics.integrationtests.model.ExpectedResponse; +import org.springframework.test.web.servlet.ResultActions; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ResponseValidator { + + private final ObjectMapper objectMapper = new ObjectMapper(); + + public void validateResponse( ResultActions actual, ExpectedResponse expectedResponse ) throws Exception { + actual.andExpect( status().is( expectedResponse.getStatus() ) ); + + if ( expectedResponse.isContent() ) { + if ( expectedResponse.getExpectedPayload() != null ) { + actual.andExpect( content().json( objectMapper.writeValueAsString( expectedResponse.getExpectedPayload() ) ) ); + } + executeAssertions( actual, expectedResponse.getAssertions() ); + } + } + + private void executeAssertions( ResultActions actual, List assertions ) throws Exception { + for ( Assertion assertion : assertions ) { + if ( assertion.getExists() != null && assertion.getExists() ) { + actual.andExpect( jsonPath( assertion.getJsonPath() ).exists() ); + } else if ( assertion.getEquals() != null ) { + actual.andExpect( jsonPath( assertion.getJsonPath(), equalTo( assertion.getEquals() ) ) ); + } else if ( assertion.getHasSize() != null ) { + actual.andExpect( jsonPath( assertion.getJsonPath(), hasSize( assertion.getHasSize() ) ) ); + } else if ( assertion.getContains() != null ) { + actual.andExpect( jsonPath( assertion.getJsonPath(), contains( assertion.getContains() ) ) ); + } else if ( assertion.getDoesNotExist() != null && assertion.getDoesNotExist() ) { + actual.andExpect( jsonPath( assertion.getJsonPath() ).doesNotExist() ); + } else if ( assertion.getHasItem() != null ) { + actual.andExpect( jsonPath( assertion.getJsonPath(), hasItem( assertion.getHasItem() ) ) ); + } else if ( assertion.getIsEmpty() != null && assertion.getIsEmpty() ) { + actual.andExpect( jsonPath( assertion.getJsonPath() ).isEmpty() ); + } else if ( assertion.getIsNotEmpty() != null && assertion.getIsNotEmpty() ) { + actual.andExpect( jsonPath( assertion.getJsonPath() ).isNotEmpty() ); + } + } + } +} diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ApiRequest.java b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ApiRequest.java new file mode 100644 index 00000000..2c8be879 --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ApiRequest.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH and others + * Copyright (c) 2024 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.semantics.integrationtests.model; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ApiRequest { + private String url; + private String tenant; + private String method; + private Object body; +} \ No newline at end of file diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/Assertion.java b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/Assertion.java new file mode 100644 index 00000000..a0eb62d3 --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/Assertion.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH and others + * Copyright (c) 2024 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.semantics.integrationtests.model; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class Assertion { + private String jsonPath; + private Boolean exists; + private Boolean doesNotExist; + private Boolean isEmpty; + private Boolean isNotEmpty; + private String equals; + private Integer hasSize; + private Object contains; + private Object hasItem; +} \ No newline at end of file diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ExpectedResponse.java b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ExpectedResponse.java new file mode 100644 index 00000000..9afd82c2 --- /dev/null +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/integrationtests/model/ExpectedResponse.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH and others + * Copyright (c) 2024 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.semantics.integrationtests.model; + +import java.util.List; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ExpectedResponse { + private int status; + private boolean content; + private List assertions; + private Object expectedPayload; +} \ No newline at end of file diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/registry/AssetAdministrationShellApiTest.java b/backend/src/test/java/org/eclipse/tractusx/semantics/registry/AssetAdministrationShellApiTest.java deleted file mode 100644 index 1697bbcd..00000000 --- a/backend/src/test/java/org/eclipse/tractusx/semantics/registry/AssetAdministrationShellApiTest.java +++ /dev/null @@ -1,1242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2021 Robert Bosch Manufacturing Solutions GmbH and others - * Copyright (c) 2021 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.semantics.registry; - -import static org.eclipse.tractusx.semantics.registry.TestUtil.*; -import static org.hamcrest.Matchers.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Base64; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.lang3.RandomStringUtils; -import org.eclipse.tractusx.semantics.aas.registry.model.AssetAdministrationShellDescriptor; -import org.eclipse.tractusx.semantics.aas.registry.model.AssetLink; -import org.eclipse.tractusx.semantics.aas.registry.model.Endpoint; -import org.eclipse.tractusx.semantics.aas.registry.model.LangStringTextType; -import org.eclipse.tractusx.semantics.aas.registry.model.SpecificAssetId; -import org.eclipse.tractusx.semantics.aas.registry.model.SubmodelDescriptor; -import org.eclipse.tractusx.semantics.registry.service.ShellService; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultHandlers; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - -public class AssetAdministrationShellApiTest extends AbstractAssetAdministrationShellApi { - - @Nested - @DisplayName("Shell CRUD API") - class ShellAPITests { - - - @Test - public void testCreateShellExpectSuccess() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - AssetAdministrationShellDescriptor onlyRequiredFieldsShell = TestUtil.createCompleteAasDescriptor(); - onlyRequiredFieldsShell.setId( UUID.randomUUID().toString() ); - - performShellCreateRequest( mapper.writeValueAsString( onlyRequiredFieldsShell ) ); - - } - - @Test - public void testCreateShellExpectRegexError() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - - //set assetType wrong value according to regex pattern - shellPayload.setAssetType( "AssetType \u0000" ); - - mvc.perform( - MockMvcRequestBuilders - .post(SHELL_BASE_PATH) - .accept(MediaType.APPLICATION_JSON) - .contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString( shellPayload )) - .with(jwtTokenFactory.allRoles()) - ) - .andDo(MockMvcResultHandlers.print()) - .andExpect(status().isBadRequest()) - .andExpect( jsonPath( "$.messages[0].text", is( "must match \"^([\\x09\\x0a\\x0d\\x20-\\ud7ff\\ue000-\\ufffd]|\\ud800[\\udc00-\\udfff]|[\\ud801-\\udbfe][\\udc00-\\udfff]|\\udbff[\\udc00-\\udfff])*$\"" ) ) ); - } - - @Test - public void testCreateShellWithExistingIdExpectBadRequest() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isBadRequest() ) - .andExpect( jsonPath( "$.messages[0].text", is( "An AssetAdministrationShell for the given identification does already exists." ) ) ); - } - - @Test - public void testGetShellExpectSuccess() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - String expectedPayload = mapper.writeValueAsString( shellPayload ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - String shellId = shellPayload.getId(); - - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SHELL_BASE_PATH, getEncodedValue( shellId ) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect(content().json(expectedPayload)); - } - - @Test - public void testGetShellExpectNotFound() throws Exception { - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SHELL_BASE_PATH, "NotExistingShellId" ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ); - } - - @Test - public void testGetAllShellsExpectSuccess() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - mvc.perform( - MockMvcRequestBuilders - .get( SHELL_BASE_PATH ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .queryParam( "limit", "100" ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.result" ).exists() ); - } - - @Test - public void testUpdateShellExpectSuccess() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - shellPayload.getDisplayName().get( 0 ).setLanguage( "fr" ); - - String shellId = shellPayload.getId(); - shellPayload.setIdShort( RandomStringUtils.random(10, true, true) ); - shellPayload.getSubmodelDescriptors().get( 0 ).setIdShort( RandomStringUtils.random(10, true, true) ); - - mvc.perform( - MockMvcRequestBuilders - .put( SINGLE_SHELL_BASE_PATH, getEncodedValue(shellId) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNoContent() ); - - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SHELL_BASE_PATH, getEncodedValue( shellId ) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.displayName[0].language", is("fr") ) ); - } - - @Test - public void testUpdateShellExpectNotFound() throws Exception { - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - - mvc.perform( - MockMvcRequestBuilders - .put( SINGLE_SHELL_BASE_PATH, getEncodedValue("shellIdthatdoesnotexists") ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Shell for identifier shellIdthatdoesnotexists not found" ) ) ); - } - - @Test - public void testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - String shellId = shellPayload.getId(); - - String changedID = UUID.randomUUID().toString(); - shellPayload.setId( changedID ); - shellPayload.setIdShort( "newIdShortInUpdateRequest" ); - - shellPayload.getSubmodelDescriptors().get( 0 ).setIdShort( RandomStringUtils.random(10, true, true) ); - - mvc.perform( - MockMvcRequestBuilders - .put( SINGLE_SHELL_BASE_PATH, getEncodedValue(shellId) ) - .accept( MediaType.APPLICATION_JSON ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNoContent() ); - - // verify that anything expect the identification can be updated - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SHELL_BASE_PATH, getEncodedValue( shellId ) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.id", is( shellId ) ) ); - } - - @Test - public void testDeleteShellExpectSuccess() throws Exception { - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - String shellId = shellPayload.getId(); - mvc.perform( - MockMvcRequestBuilders - .delete( SINGLE_SHELL_BASE_PATH, getEncodedValue(shellId) ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNoContent() ); - } - - @Test - public void testDeleteShellExpectNotFound() throws Exception { - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - String shellId = shellPayload.getId(); - mvc.perform( - MockMvcRequestBuilders - .delete( SINGLE_SHELL_BASE_PATH, getEncodedValue(shellId) ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNoContent() ); - } - - /** - * It must be possible to create multiple specificAssetIds for the same key. - */ - @Test - public void testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess() throws Exception { - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - shellPayload.setSpecificAssetIds( null ); - - SpecificAssetId specificAssetId1 = new SpecificAssetId(); - specificAssetId1.setName( "WMI" ); - specificAssetId1.setValue( "identifier1ValueExample" ); - - SpecificAssetId specificAssetId2 = new SpecificAssetId(); - specificAssetId2.setName( "WMI" ); - specificAssetId2.setValue( "identifier2ValueExample" ); - shellPayload.setSpecificAssetIds( List.of( specificAssetId1, specificAssetId2 ) ); - - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated() ) - .andExpect(content().json(mapper.writeValueAsString(shellPayload))); - } - } - - @Nested - @DisplayName( "Shell SpecificAssetId CRUD API" ) - class SpecificAssetIdAPITests { - - @Test - public void testCreateSpecificAssetIdsExpectSuccess() throws Exception { - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - String shellId = shellPayload.getId(); - ArrayNode specificAssetIds = emptyArrayNode() - .add( specificAssetId( "key1", "value1" ) ) - .add( specificAssetId( "key2", "value2" ) ); - - mvc.perform( - MockMvcRequestBuilders - .post( SINGLE_LOOKUP_SHELL_BASE_PATH, getEncodedValue(shellId ) ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( toJson( specificAssetIds ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated() ) - .andExpect( content().json( toJson( specificAssetIds ) ) ); - } - - /** - * The API method for creation of specificAssetIds accepts an array of objects. - * Invoking the API adds the new specificAssetIds to existing ones. - */ - @Test - public void testCreateSpecificAssetIdsAddToExistingSpecificAssetIdsExpectSuccess() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - String shellId = shellPayload.getId(); - - ArrayNode specificAssetIds = emptyArrayNode() - .add( specificAssetId( "key1", "value1" ) ) - .add( specificAssetId( "key2", "value2" ) ); - - mvc.perform( - MockMvcRequestBuilders - .post( SINGLE_LOOKUP_SHELL_BASE_PATH, getEncodedValue( shellId ) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( toJson( specificAssetIds ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated() ) - .andExpect(content().json(toJson(specificAssetIds))); - - // verify that the shell payload does no longer contain the initial specificAssetIds that were provided at creation time - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SHELL_BASE_PATH, getEncodedValue( shellId ) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect(jsonPath("$.specificAssetIds", hasSize(4))); - } - - @Test - public void testCreateSpecificIdsExpectNotFound() throws Exception { - ArrayNode specificAssetIds = emptyArrayNode() - .add( specificAssetId( "key1", "value1" ) ); - mvc.perform( - MockMvcRequestBuilders - .post( SINGLE_LOOKUP_SHELL_BASE_PATH,getEncodedValue("notexistingshell" ) ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( toJson( specificAssetIds ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Shell for identifier notexistingshell not found" ) ) ); - } - - @Test - public void testGetSpecificAssetIdsExpectSuccess() throws Exception { - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - String shellId = shellPayload.getId(); - - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_LOOKUP_SHELL_BASE_PATH, getEncodedValue( shellId ) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect(content().json(mapper.writeValueAsString(shellPayload.getSpecificAssetIds()))); - } - - @Test - public void testGetSpecificIdsExpectNotFound() throws Exception { - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_LOOKUP_SHELL_BASE_PATH, getEncodedValue("notexistingshell" ), getEncodedValue("notexistingsubmodel" ) ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Shell for identifier notexistingshell not found" ) ) ); - } - } - - @Nested - @DisplayName( "Submodel CRUD API" ) - class SubmodelApiTest { - - @Test - public void testCreateSubmodelExpectSuccess() throws Exception { - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - - String shellId = shellPayload.getId(); - - SubmodelDescriptor submodelDescriptor = TestUtil.createSubmodel(); - - performSubmodelCreateRequest( mapper.writeValueAsString( submodelDescriptor ), getEncodedValue( shellId ) ); - - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SHELL_BASE_PATH, getEncodedValue( shellId ) ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.submodelDescriptors", hasSize( 2 ) ) ) - .andExpect(jsonPath("$.submodelDescriptors[*].id", hasItem(submodelDescriptor.getId()))); - } - - @Test - public void testCreateSubmodelWithExistingIdExpectBadRequest() throws Exception { - - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - - // assign submodel with existing id to shellPayload1 to ensure global uniqueness - String shellId = shellPayload1.getId(); - SubmodelDescriptor existingSubmodel = shellPayload1.getSubmodelDescriptors().get( 0 ); - mvc.perform( - MockMvcRequestBuilders - .post( SUB_MODEL_BASE_PATH, getEncodedValue(shellId) ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( existingSubmodel ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isBadRequest() ) - .andExpect( jsonPath( "$.messages[0].text", is( ShellService.DUPLICATE_SUBMODEL_ID_SHORT_EXCEPTION ) ) ); - } - - @Test - public void testUpdateSubModelExpectSuccess() throws Exception { - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - - SubmodelDescriptor submodel = TestUtil.createSubmodel(); - performSubmodelCreateRequest( mapper.writeValueAsString( submodel ),getEncodedValue( shellPayload1.getId() )); - String submodelId = submodel.getId(); - - SubmodelDescriptor updatedSubmodel = TestUtil.createSubmodel(); - updatedSubmodel.setId( submodelId ); - updatedSubmodel.setIdShort( "updatedSubmodelId" ); - LangStringTextType updateDescription = new LangStringTextType(); - updateDescription.setLanguage( "cn" ); - updateDescription.setText( "chinese text" ); - - updatedSubmodel.setDescription( List.of( updateDescription ) ); - - mvc.perform( - MockMvcRequestBuilders - .put( SINGLE_SUB_MODEL_BASE_PATH, getEncodedValue( shellPayload1.getId() ), getEncodedValue( submodelId ) ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( updatedSubmodel ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNoContent() ); - - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SUB_MODEL_BASE_PATH,getEncodedValue( shellPayload1.getId() ), getEncodedValue( submodelId )) - .accept( MediaType.APPLICATION_JSON ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect(content().json(mapper.writeValueAsString( updatedSubmodel ))); - } - - @Test - public void testUpdateSubmodelExpectNotFound() throws Exception { - // verify shell is missing - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SUB_MODEL_BASE_PATH, getEncodedValue( "notexistingshell") , getEncodedValue( "notexistingsubmodel") ) - .accept( MediaType.APPLICATION_JSON ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Shell for identifier notexistingshell not found" ) ) ); - - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - // verify submodel is missing - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SUB_MODEL_BASE_PATH, getEncodedValue(shellPayload1.getId()), getEncodedValue("notexistingsubmodel") ) - .accept( MediaType.APPLICATION_JSON ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Submodel for identifier notexistingsubmodel not found." ) ) ); - } - - @Test - public void testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdIsTaken() throws Exception { - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - String shellId = shellPayload1.getId(); - - SubmodelDescriptor submodel = TestUtil.createSubmodel(); - performSubmodelCreateRequest( mapper.writeValueAsString( submodel ), getEncodedValue( shellPayload1.getId() ) ); - - String submodelId = submodel.getId(); - submodel.setIdShort( "newIdShortInUpdateRequest" ); - - mvc.perform( - MockMvcRequestBuilders - .put( SINGLE_SUB_MODEL_BASE_PATH, getEncodedValue( shellId ), getEncodedValue( submodelId ) ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( submodel ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNoContent() ); - - // verify that anything expect the identification can be updated - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SUB_MODEL_BASE_PATH, getEncodedValue( shellId ), getEncodedValue( submodelId )) - .accept( MediaType.APPLICATION_JSON ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect(content().json(mapper.writeValueAsString(submodel))); - } - - @Test - public void testDeleteSubmodelExpectSuccess() throws Exception { - - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - String shellId = shellPayload1.getId(); - - SubmodelDescriptor submodel = TestUtil.createSubmodel(); - performSubmodelCreateRequest( mapper.writeValueAsString( submodel ),getEncodedValue( shellPayload1.getId()) ); - - String submodelId = submodel.getId(); - - mvc.perform( - MockMvcRequestBuilders - .delete( SINGLE_SUB_MODEL_BASE_PATH,getEncodedValue( shellId) , getEncodedValue( submodelId) ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNoContent() ); - - mvc.perform( - MockMvcRequestBuilders - .get( SINGLE_SUB_MODEL_BASE_PATH, getEncodedValue( shellId) , getEncodedValue( submodelId)) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ); - } - - @Test - public void testDeleteSubmodelExpectNotFound() throws Exception { - // verify shell is missing - mvc.perform( - MockMvcRequestBuilders - .delete( SINGLE_SUB_MODEL_BASE_PATH, getEncodedValue( "notexistingshell" ), getEncodedValue( "notexistingsubmodel" )) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Shell for identifier notexistingshell not found" ) ) ); - - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - String shellId = shellPayload1.getId(); - // verify submodel is missing - mvc.perform( - MockMvcRequestBuilders - .delete( SINGLE_SUB_MODEL_BASE_PATH,getEncodedValue( shellId) ,getEncodedValue( "notexistingsubmodel") ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isNotFound() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Submodel for identifier notexistingsubmodel not found." ) ) ); - } - } - - @Nested - @DisplayName( "Shell Lookup Query API" ) - class ShellLookupQueryAPI { - - @Test - public void testLookUpApiWithInvalidQueryParameterExpectFailure() throws Exception { - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .queryParam( "assetIds", "{ invalid }" ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isBadRequest() ) - .andExpect( jsonPath( "$.messages[0].text", is( "Incorrect Base64 encoded value provided as parameter" ) ) ); - } - - @Test - public void testLookUpApiWithSwaggerUIEscapedQueryParameterExpectSuccess() throws Exception { - String swaggerUIEscapedAssetIds = "[\"{\\n \\\"name\\\": \\\"brakenumber\\\",\\n \\\"value\\\": \\\"123f092\\\"\\n}\",{\"name\":\"globalAssetId\",\"value\":\"12397f2kf97df\"}]"; - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .queryParam( "aasIdentifier", swaggerUIEscapedAssetIds ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( content().string( "{}" )); - } - - @Test - public void testLookUpApiWithMultiParamIds() throws Exception { - String assetId1 = "{\"name\": \"brakenumber\",\"value\": \"123f092\"}"; - String assetId2 = "{\"name\":\"globalAssetId\",\"value\":\"12397f2kf97df\"}"; - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .queryParam( "aasIdentifier", assetId1 ) - .queryParam( "aasIdentifier", assetId2 ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( content().string( "{}" )); - } - - @Test - public void testFindExternalShellIdsBySpecificAssetIdsExpectSuccess() throws Exception { - - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - - AssetAdministrationShellDescriptor shellPayload2 = TestUtil.createCompleteAasDescriptor(); - shellPayload2.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload2 ) ); - - SpecificAssetId specificAssetId1 = TestUtil.createSpecificAssetId(); - String encodedSa1 = Base64.getUrlEncoder().encodeToString(serialize( specificAssetId1)); - - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .queryParam( "assetIds", encodedSa1 ) - .queryParam( "limit", "1" ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.paging_metadata.cursor" ).exists() ); - - // Test first shell match with single assetId - - SpecificAssetId specificAssetId2 = TestUtil.createSpecificAssetId( "identifier99KeyExample", "identifier99ValueExample", null ); - String encodedSa2 = Base64.getUrlEncoder().encodeToString(serialize( specificAssetId2)); - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .queryParam( "assetIds", encodedSa2) - .queryParam( "limit", "10" ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.paging_metadata.cursor" ).doesNotExist() ); - - // // Test first and second shell match with common asssetId - - SpecificAssetId specificAssetId3 = TestUtil.createSpecificAssetId( "commonAssetIdKey", "commonAssetIdValue", null ); - String encodedSa3 = Base64.getUrlEncoder().encodeToString(serialize( specificAssetId3)); - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .queryParam( "assetIds", encodedSa3 ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.result", hasSize( 0 ) ) ); - } - - - @Test - public void testFindExternalShellIdsByAssetLinkExpectSuccess() throws Exception { - - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - - AssetAdministrationShellDescriptor shellPayload2 = TestUtil.createCompleteAasDescriptor(); - shellPayload2.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload2 ) ); - - AssetLink assetLink1 = TestUtil.createAssetLink(); - List list1 = new ArrayList<>(); - list1.add( assetLink1 ); - - mvc.perform( - MockMvcRequestBuilders - .post( LOOKUP_SHELL_BASE_PATH_POST ) - .queryParam( "limit", "1" ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsBytes(list1) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.paging_metadata.cursor" ).exists() ); - - // Test first shell match with single assetLink - - AssetLink assetLink2 = TestUtil.createAssetLink( "identifier99KeyExample", "identifier99ValueExample" ); - List list2 = new ArrayList<>(); - list2.add( assetLink2 ); - mvc.perform( - MockMvcRequestBuilders - .post( LOOKUP_SHELL_BASE_PATH_POST ) - .queryParam( "limit", "10" ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsBytes(list2) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.paging_metadata.cursor" ).doesNotExist() ); - - // Test first and second shell match with common assetLink - - AssetLink assetLink3 = TestUtil.createAssetLink( "commonAssetIdKey", "commonAssetIdValue" ); - List list3 = new ArrayList<>(); - list3.add( assetLink3 ); - mvc.perform( - MockMvcRequestBuilders - .post( LOOKUP_SHELL_BASE_PATH_POST ) - .queryParam( "limit", "10" ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsBytes(list3) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.result", hasSize( 0 ) ) ); - } - - @Test - public void testFindExternalShellIdByGlobalAssetIdExpectSuccess() throws Exception { - - String globalAssetId = UUID.randomUUID().toString(); - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - shellPayload.setGlobalAssetId( globalAssetId ); - String payload = mapper.writeValueAsString( shellPayload ); - performShellCreateRequest(payload ); - - // for lookup global asset id is handled as specificAssetIds - SpecificAssetId SAGlobal = TestUtil.createSpecificAssetId("globalAssetId",globalAssetId,null); - String encodedSa1 = Base64.getUrlEncoder().encodeToString(serialize( SAGlobal)); - - - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .queryParam( "assetIds", encodedSa1) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.result", hasSize( 1 ) ) ) - // ensure that only three results match - .andExpect( jsonPath( "$.result", contains( shellPayload.getId() ) ) ); - } - - @Test - public void testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess() throws Exception { - - String globalAssetId = UUID.randomUUID().toString(); - - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - shellPayload.setGlobalAssetId( globalAssetId ); - String payload = mapper.writeValueAsString( shellPayload ); - performShellCreateRequest(payload ); - - // for lookup global asset id is handled as AssetLink - AssetLink SAGlobal = TestUtil.createAssetLink("globalAssetId",globalAssetId); - - List list = new ArrayList<>(); - list.add( SAGlobal ); - - mvc.perform( - MockMvcRequestBuilders - .post( LOOKUP_SHELL_BASE_PATH_POST ) - .header( EXTERNAL_SUBJECT_ID_HEADER, jwtTokenFactory.tenantOne().getTenantId() ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsBytes(list) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.result", hasSize( 1 ) ) ) - // ensure that only three results match - .andExpect( jsonPath( "$.result", contains( shellPayload.getId() ) ) ); - } - - @Test - public void testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult() throws Exception { - // prepare the data set - mvc.perform( - MockMvcRequestBuilders - .get( LOOKUP_SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( content().string( "{}" )); - - } - } - - @Nested - @DisplayName( "Custom AAS API Tests" ) - class CustomAASApiTest { - - //@Test - public void testCreateShellInBatchWithOneDuplicateExpectSuccess() throws Exception { - ObjectNode shell = createShell(); - - JsonNode identification = shell.get( "identification" ); - ArrayNode batchShellBody = emptyArrayNode().add( shell ).add( createShell() - // create duplicate - .set( "identification", identification ) ); - - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH + "/batch" ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( toJson( batchShellBody ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated() ) - .andExpect( jsonPath( "$", hasSize( 2 ) ) ) - .andExpect( jsonPath( "$[0].message", equalTo( "AssetAdministrationShell successfully created." ) ) ) - .andExpect( jsonPath( "$[0].identification", equalTo( identification.textValue() ) ) ) - .andExpect( jsonPath( "$[0].status", equalTo( 200 ) ) ) - .andExpect( jsonPath( "$[1].message", equalTo( "An AssetAdministrationShell for the given identification does already exists." ) ) ) - .andExpect( jsonPath( "$[1].identification", equalTo( identification.textValue() ) ) ) - .andExpect( jsonPath( "$[1].status", equalTo( 400 ) ) ); - } - - // @Test - public void testCreateShellInBatchExpectSuccess() throws Exception { - ArrayNode batchShellBody = emptyArrayNode().add( createShell() ) - .add( createShell() ) - .add( createShell() ) - .add( createShell() ) - .add( createShell() ); - - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH + "/batch" ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( toJson( batchShellBody ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated() ) - .andExpect( jsonPath( "$", hasSize( 5 ) ) ); - } - - //@Test - public void testFetchShellsByNoIdentificationsExpectEmptyResult() throws Exception { - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH + "/fetch" ) - .content( toJson( emptyArrayNode() ) ) - .contentType( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.items", hasSize( 0 ) ) ); - } - - //@Test - public void testFetchShellsByMultipleIdentificationsExpectSuccessExpectSuccess() throws Exception { - - ObjectNode shellPayload1 = createShell(); - performShellCreateRequest( toJson( shellPayload1 ) ); - - ObjectNode shellPayload2 = createShell(); - performShellCreateRequest( toJson( shellPayload2 ) ); - - ArrayNode fetchOneShellsById = emptyArrayNode().add( getId( shellPayload1 ) ); - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH + "/fetch" ) - .content( toJson( fetchOneShellsById ) ) - .contentType( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.items", hasSize( 1 ) ) ) - // ensure that only three results match - .andExpect( jsonPath( "$.items[*].identification", hasItem( getId( shellPayload1 ) ) ) ); - - ArrayNode fetchTwoShellsById = emptyArrayNode() - .add( getId( shellPayload1 ) ) - .add( getId( shellPayload2 ) ); - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH + "/fetch" ) - .content( toJson( fetchTwoShellsById ) ) - .contentType( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.items", hasSize( 2 ) ) ) - // ensure that only three results match - .andExpect( jsonPath( "$.items[*].identification", - hasItems( getId( shellPayload1 ), getId( shellPayload2 ) ) ) ); - } - } - - @Test - @DisplayName( "Test creating a new Asset Administration Shell Descriptor with unique IdShort in shell and submodelDescriptor level" ) - public void test_Creating_a_new_Asset_Administration_Shell_Descriptor_with_unique_IdShort_in_shell_and_submodelDescriptor_level() throws Exception { - //Given - removedAllShells(); - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - //When & Then - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated()); - } - - @Test - @DisplayName( "Test creating a new Asset Administration Shell Descriptor with empty IdShort in shell and submodelDescriptor level" ) - public void test_Creating_a_new_Asset_Administration_Shell_Descriptor_with_empty_IdShort_in_shell_and_submodelDescriptor_level() throws Exception { - //Given - removedAllShells(); - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setIdShort( null ); - shellPayload.getSubmodelDescriptors().get( 0 ).setIdShort( null ); - //When & Then - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated()); - } - - @Test - @DisplayName( "Test creating a new Asset Administration Shell Descriptor with empty IdShort in shell and valid IdShort in submodelDescriptor level" ) - public void test_Creating_a_new_Asset_Administration_Shell_Descriptor_with_empty_IdShort_in_shell_and_valid_IdShort_in_submodelDescriptor_level() throws Exception { - //Given - removedAllShells(); - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setIdShort( null ); - //When & Then - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated()); - } - - @Test - @DisplayName( "Test creating a new Asset Administration Shell Descriptor with valid IdShort in shell and empty IdShort in submodelDescriptor level" ) - public void test_Creating_a_new_Asset_Administration_Shell_Descriptor_with_valid_IdShort_in_shell_and_empty_IdShort_in_submodelDescriptor_level() throws Exception { - //Given - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.getSubmodelDescriptors().get( 0 ).setIdShort( null ); - //When & Then - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated()); - } - - @Test - @DisplayName( "Test creating a new Asset Administration Shell Descriptor with dupilcate IdShort in shell level" ) - public void test_Creating_a_new_Asset_Administration_Shell_Descriptor_with_Dupilcate_IdShort_in_shell_level() throws Exception { - //Given - removedAllShells(); - //Creates a shell using test data - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - shellPayload.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload ) ); - String idShort = shellPayload.getIdShort(); - - //Creating a new shell with unique Shell.IdShort and Shell.SubmodelDescriptor.IdShort - shellPayload = TestUtil.createCompleteAasDescriptor(); - //setting duplicate idShort is shell level - shellPayload.setIdShort( idShort ); - - //When & Then - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isBadRequest() ) - .andExpect( jsonPath( "$.messages[0].text", is( "An AssetAdministrationShell for the given IdShort already exists." ) ) ); - } - - private void removedAllShells() { - shellRepository.deleteAll(); - } - - @Test - @DisplayName( "Test Creating a new Asset Administration Shell Descriptor with unique IdShort in shell level and duplicate IdShort in submodelDescriptor level" ) - public void test_Creating_a_new_Asset_Administration_Shell_Descriptor_with_unique_IdShort_in_shell_level_and_duplicate_submodelDescriptor_level() throws Exception { - //Given - removedAllShells(); - AssetAdministrationShellDescriptor shellPayload = TestUtil.createCompleteAasDescriptor(); - - //Duplicate submodel to simulate duplicate idshort - shellPayload.getSubmodelDescriptors().add( shellPayload.getSubmodelDescriptors().get( 0 ) ); - - - //When & Then - mvc.perform( - MockMvcRequestBuilders - .post( SHELL_BASE_PATH ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( shellPayload ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isBadRequest() ) - .andExpect( jsonPath( "$.messages[0].text", is( ShellService.DUPLICATE_SUBMODEL_ID_SHORT_EXCEPTION ) ) ); - } - - @Test - @DisplayName( "Test Creating a new Submodel Descriptor with unique IdShort in submodelDescriptor level" ) - public void test_Creates_a_new_Submodel_Descriptor_with_unique_IdShort_in_submodelDescriptor_level() throws Exception { - //Given - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - - String shellId = shellPayload1.getId(); - //Get new SubmodelDescriptor which contains unique IdShort - SubmodelDescriptor submodel = TestUtil.createCompleteAasDescriptor().getSubmodelDescriptors().get( 0 ); - mvc.perform( - MockMvcRequestBuilders - .post( SUB_MODEL_BASE_PATH, getEncodedValue(shellId) ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( submodel ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isCreated()); - } - - @Test - @DisplayName( "Test Creating a new Submodel Descriptor with duplicate IdShort in submodelDescriptor level - DB" ) - public void test_Creates_a_new_Submodel_Descriptor_with_duplicate_IdShort_in_submodelDescriptor_level_in_DB() throws Exception { - //Given - AssetAdministrationShellDescriptor shellPayload1 = TestUtil.createCompleteAasDescriptor(); - shellPayload1.setId( UUID.randomUUID().toString() ); - performShellCreateRequest( mapper.writeValueAsString( shellPayload1 ) ); - - String shellId = shellPayload1.getId(); - SubmodelDescriptor submodel = shellPayload1.getSubmodelDescriptors().get( 0 ); - submodel.setId( UUID.randomUUID().toString() ); - - //When & Then - mvc.perform( - MockMvcRequestBuilders - .post( SUB_MODEL_BASE_PATH, getEncodedValue(shellId) ) - .accept( MediaType.APPLICATION_JSON ) - .contentType( MediaType.APPLICATION_JSON ) - .content( mapper.writeValueAsString( submodel ) ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isBadRequest() ) - .andExpect( jsonPath( "$.messages[0].text", is( ShellService.DUPLICATE_SUBMODEL_ID_SHORT_EXCEPTION ) ) ); - } - - - @Nested - @DisplayName( "Description Tests" ) - class DescriptionApiTest { - @Test - public void testGetDescriptionExpectSuccess() throws Exception { - mvc.perform( - MockMvcRequestBuilders - .get( "/api/v3/description" ) - .accept( MediaType.APPLICATION_JSON ) - .with( jwtTokenFactory.allRoles() ) - ) - .andDo( MockMvcResultHandlers.print() ) - .andExpect( status().isOk() ) - .andExpect( jsonPath( "$.profiles[0]", is( "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-001" ) ) ); - } - } - -} \ No newline at end of file diff --git a/backend/src/test/java/org/eclipse/tractusx/semantics/registry/JwtTokenFactory.java b/backend/src/test/java/org/eclipse/tractusx/semantics/registry/JwtTokenFactory.java index 2ae25da4..93e67ede 100644 --- a/backend/src/test/java/org/eclipse/tractusx/semantics/registry/JwtTokenFactory.java +++ b/backend/src/test/java/org/eclipse/tractusx/semantics/registry/JwtTokenFactory.java @@ -54,6 +54,19 @@ public JwtTokenFactory( String publicClientId ) { this.tenantThree = new Tenant( publicClientId, TENANT_THREE ); } + public Tenant getTenant(String tenant) { + switch ( tenant ) { + case TENANT_ONE: + return tenantOne; + case TENANT_TWO: + return tenantTwo; + case TENANT_THREE: + return tenantThree; + default: + return null; + } + }; + public RequestPostProcessor allRoles() { return tenantOne.allRoles(); } diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/expected-response.json new file mode 100644 index 00000000..b6a3ad06 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/expected-response.json @@ -0,0 +1,6 @@ +{ + "status": 404, + "content": false, + "assertions": [], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/request.json new file mode 100644 index 00000000..c614774a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/10_testDeleteShellExpectNotFound/1_delete_shell/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/U2hlbGxJZE5vdEV4aXN0cw", + "tenant": "TENANT_ONE", + "method": "DELETE", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..59d20de8 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"a60a9297", + "id":"a60a9297-ff06-45b4-b4c7-fb7ea05a60e2", + "specificAssetIds":[ + { + "name":"WMI", + "value":"identifier1ValueExample" + }, + { + "name":"WMI", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..8a66400f --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/11_testCreateShellWithSameSpecificAssetIdKeyButDifferentValuesExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":"a60a9297", + "id":"a60a9297-ff06-45b4-b4c7-fb7ea05a60e2", + "specificAssetIds":[ + { + "name":"WMI", + "value":"identifier1ValueExample" + }, + { + "name":"WMI", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..78f76e31 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,25 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + + ], + "displayName":[ + + ], + "idShort":"nHZ0ep2GHB", + "id":"13a81c5b-e0ae-4c07-b449-6cee2efa7afe", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..04d63abb --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"nHZ0ep2GHB", + "id":"13a81c5b-e0ae-4c07-b449-6cee2efa7afe", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/expected-response.json new file mode 100644 index 00000000..e58de018 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/expected-response.json @@ -0,0 +1,15 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": [ + { + "name":"key1", + "value":"value1" + }, + { + "name":"key2", + "value":"value2" + } + ] +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/request.json new file mode 100644 index 00000000..f330f803 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/2_update_specific_asset_ids/request.json @@ -0,0 +1,15 @@ +{ + "url": "/api/v3/lookup/shells/MTNhODFjNWItZTBhZS00YzA3LWI0NDktNmNlZTJlZmE3YWZl", + "tenant": "TENANT_ONE", + "method": "POST", + "body": [ + { + "name":"key1", + "value":"value1" + }, + { + "name":"key2", + "value":"value2" + } + ] +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..d50a01b3 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/expected-response.json @@ -0,0 +1,33 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + + ], + "displayName":[ + + ], + "idShort":"nHZ0ep2GHB", + "id":"13a81c5b-e0ae-4c07-b449-6cee2efa7afe", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + }, + { + "name":"key1", + "value":"value1" + }, + { + "name":"key2", + "value":"value2" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/request.json new file mode 100644 index 00000000..d3971d54 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/12_testCreateSpecificAssetIdsExpectSuccess/3_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/MTNhODFjNWItZTBhZS00YzA3LWI0NDktNmNlZTJlZmE3YWZl", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/expected-response.json new file mode 100644 index 00000000..6ddcc57f --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/expected-response.json @@ -0,0 +1,11 @@ +{ + "status": 404, + "content": true, + "assertions": [ + { + "jsonPath": "$.messages[0].text", + "equals": "Shell for identifier notexistingshell not found" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/request.json new file mode 100644 index 00000000..bc07ba38 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/13_testCreateSpecificAssetIdsExpectedNotFound/1_update_specific_asset_ids/request.json @@ -0,0 +1,11 @@ +{ + "url": "/api/v3/lookup/shells/bm90ZXhpc3RpbmdzaGVsbA==", + "tenant": "TENANT_ONE", + "method": "POST", + "body": [ + { + "name":"key1", + "value":"value1" + } + ] +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/expected-response.json new file mode 100644 index 00000000..6ddcc57f --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/expected-response.json @@ -0,0 +1,11 @@ +{ + "status": 404, + "content": true, + "assertions": [ + { + "jsonPath": "$.messages[0].text", + "equals": "Shell for identifier notexistingshell not found" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/request.json new file mode 100644 index 00000000..69510afc --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/14_testGetSpecificAssetIdsExpectedNotFound/1_get_specific_asset_ids/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/lookup/shells/bm90ZXhpc3RpbmdzaGVsbA==", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..8748e590 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"IFvhtUByCk", + "id":"dad18a5f-0c2e-4841-9aeb-a3ee7110bd3b", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..17764b91 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"IFvhtUByCk", + "id":"dad18a5f-0c2e-4841-9aeb-a3ee7110bd3b", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..7a288eb8 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,42 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "idShort":"zxU5hJfkzL", + "id":"f80d77c7-59d9-4c43-83ee-4fa32615118b", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..cd8d4093 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/ZGFkMThhNWYtMGMyZS00ODQxLTlhZWItYTNlZTcxMTBiZDNi/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"zxU5hJfkzL", + "id":"f80d77c7-59d9-4c43-83ee-4fa32615118b", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json new file mode 100644 index 00000000..5818fe73 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json @@ -0,0 +1,15 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.submodelDescriptors", + "hasSize": 1 + }, + { + "jsonPath": "$.submodelDescriptors[*].id", + "hasItem": "f80d77c7-59d9-4c43-83ee-4fa32615118b" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/request.json new file mode 100644 index 00000000..5ddfe9f9 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/15_testCreateSubmodelExpectSuccess/3_get_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/shell-descriptors/ZGFkMThhNWYtMGMyZS00ODQxLTlhZWItYTNlZTcxMTBiZDNi", + "tenant": "TENANT_ONE", + "method":"GET", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/expected-response.json new file mode 100644 index 00000000..99ae3bb1 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/expected-response.json @@ -0,0 +1,61 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"623Sm0sFia", + "id":"ad2503a6-9309-4d29-9d1b-ae9a7884c67f", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors": [ + { + "idShort":"KdlMzDfb5r", + "id":"3284eb08-1093-41fa-8c05-226c7e2dc83a", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/request.json new file mode 100644 index 00000000..393e7036 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/1_post_shell/request.json @@ -0,0 +1,61 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "description":[], + "displayName":[], + "idShort":"623Sm0sFia", + "id":"ad2503a6-9309-4d29-9d1b-ae9a7884c67f", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors": [ + { + "idShort":"KdlMzDfb5r", + "id":"3284eb08-1093-41fa-8c05-226c7e2dc83a", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..f61cd37b --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,11 @@ +{ + "status": 400, + "content": true, + "assertions": [ + { + "jsonPath": "$.messages[0].text", + "equals": "An AssetAdministration Submodel for the given IdShort does already exists." + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..8a926ec6 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/16_testCreateSubmodelWithExistingIdExpectBadRequest/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/YWQyNTAzYTYtOTMwOS00ZDI5LTlkMWItYWU5YTc4ODRjNjdm/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"KdlMzDfb5r", + "id":"f80d77c7-59d9-4c43-83ee-4fa32615118b", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..3b0ab1f4 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"JpAE96cnL7", + "id":"c37b0178-7c86-46d7-8e8e-2597000afd8a", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..0acafea7 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"JpAE96cnL7", + "id":"c37b0178-7c86-46d7-8e8e-2597000afd8a", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..1af97a41 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,42 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "idShort":"l53zdpYEBq", + "id":"58ced603-8226-446d-8671-3f7501ab7a36", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..ac8ccc1d --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/YzM3YjAxNzgtN2M4Ni00NmQ3LThlOGUtMjU5NzAwMGFmZDhh/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"l53zdpYEBq", + "id":"58ced603-8226-446d-8671-3f7501ab7a36", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..02ef1561 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/expected-response.json @@ -0,0 +1,6 @@ +{ + "status":204, + "content":true, + "assertions":[], + "expectedPayload": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/request.json new file mode 100644 index 00000000..47dc9ce4 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/3_put_submodel_descriptors/request.json @@ -0,0 +1,47 @@ +{ + "url":"/api/v3/shell-descriptors/YzM3YjAxNzgtN2M4Ni00NmQ3LThlOGUtMjU5NzAwMGFmZDhh/submodel-descriptors/NThjZWQ2MDMtODIyNi00NDZkLTg2NzEtM2Y3NTAxYWI3YTM2", + "tenant": "TENANT_ONE", + "method":"PUT", + "body": { + "idShort":"updatedSubmodelId", + "id":"58ced603-8226-446d-8671-3f7501ab7a36", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[ + { + "language": "cn", + "text": "chinese" + } + ], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/expected-response.json new file mode 100644 index 00000000..d1234ed0 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/expected-response.json @@ -0,0 +1,71 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + + ], + "displayName":[ + + ], + "idShort":"JpAE96cnL7", + "id":"c37b0178-7c86-46d7-8e8e-2597000afd8a", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors":[ + { + "idShort":"updatedSubmodelId", + "id":"58ced603-8226-446d-8671-3f7501ab7a36", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[ + { + "language":"cn", + "text":"chinese" + } + ], + "displayName":[ + + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/request.json new file mode 100644 index 00000000..9851512d --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/17_testUpdateSubmodelExpectSuccess/4_get_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/YzM3YjAxNzgtN2M4Ni00NmQ3LThlOGUtMjU5NzAwMGFmZDhh", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/expected-response.json new file mode 100644 index 00000000..04cc7908 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"nsS5XwJpBh", + "id":"0edb5e4c-5b85-4c02-a960-14373ff801c0", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/request.json new file mode 100644 index 00000000..51f78d03 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"nsS5XwJpBh", + "id":"0edb5e4c-5b85-4c02-a960-14373ff801c0", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..62985a4d --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,42 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "idShort":"IZ2rbLff6P", + "id":"8fd94b80-3d0d-494e-aaab-1623a30dc3ed", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..8c78a1aa --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/MGVkYjVlNGMtNWI4NS00YzAyLWE5NjAtMTQzNzNmZjgwMWMw/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"IZ2rbLff6P", + "id":"8fd94b80-3d0d-494e-aaab-1623a30dc3ed", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/expected-response.json new file mode 100644 index 00000000..069d73de --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/expected-response.json @@ -0,0 +1,64 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + + ], + "displayName":[ + + ], + "idShort":"nsS5XwJpBh", + "id":"0edb5e4c-5b85-4c02-a960-14373ff801c0", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors":[ + { + "idShort":"IZ2rbLff6P", + "id":"8fd94b80-3d0d-494e-aaab-1623a30dc3ed", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/request.json new file mode 100644 index 00000000..37d96af6 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/3_get_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/MGVkYjVlNGMtNWI4NS00YzAyLWE5NjAtMTQzNzNmZjgwMWMw", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..e42b2652 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/expected-response.json @@ -0,0 +1,10 @@ +{ + "status":404, + "content":true, + "assertions":[{ + "jsonPath": "$.messages[0].text", + "equals": "Submodel for identifier 58ced603-8226-446d-8671-3f7501ab7a36 not found." + } + ], + "expectedPayload": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/request.json new file mode 100644 index 00000000..9430a226 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/18_testUpdateSubmodelExpectNotFound/4_put_submodel_descriptors/request.json @@ -0,0 +1,47 @@ +{ + "url":"/api/v3/shell-descriptors/MGVkYjVlNGMtNWI4NS00YzAyLWE5NjAtMTQzNzNmZjgwMWMw/submodel-descriptors/NThjZWQ2MDMtODIyNi00NDZkLTg2NzEtM2Y3NTAxYWI3YTM2", + "tenant": "TENANT_ONE", + "method":"PUT", + "body": { + "idShort":"notexistingsubmodel", + "id":"notexistingsubmodel", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[ + { + "language": "cn", + "text": "chinese" + } + ], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/expected-response.json new file mode 100644 index 00000000..5381c7ed --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"7WXEUFyZRD", + "id":"5d4b6464-50b0-4234-8de6-1f74a836329a", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/request.json new file mode 100644 index 00000000..4305ca17 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"7WXEUFyZRD", + "id":"5d4b6464-50b0-4234-8de6-1f74a836329a", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..cbaee16d --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,42 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "idShort":"7gPmF6Y6sG", + "id":"c00b94ac-9e91-4f04-848c-9fa5b287a6ac", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..6aa0f885 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/NWQ0YjY0NjQtNTBiMC00MjM0LThkZTYtMWY3NGE4MzYzMjlh/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"7gPmF6Y6sG", + "id":"c00b94ac-9e91-4f04-848c-9fa5b287a6ac", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..02ef1561 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/expected-response.json @@ -0,0 +1,6 @@ +{ + "status":204, + "content":true, + "assertions":[], + "expectedPayload": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/request.json new file mode 100644 index 00000000..de27c361 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/3_put_submodel_descriptors/request.json @@ -0,0 +1,47 @@ +{ + "url":"/api/v3/shell-descriptors/NWQ0YjY0NjQtNTBiMC00MjM0LThkZTYtMWY3NGE4MzYzMjlh/submodel-descriptors/YzAwYjk0YWMtOWU5MS00ZjA0LTg0OGMtOWZhNWIyODdhNmFj", + "tenant": "TENANT_ONE", + "method":"PUT", + "body": { + "idShort":"newIdShortInUpdateRequest", + "id":"newSubmodelId", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[ + { + "language": "cn", + "text": "chinese" + } + ], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/expected-response.json new file mode 100644 index 00000000..be4be331 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/expected-response.json @@ -0,0 +1,71 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + + ], + "displayName":[ + + ], + "idShort":"7WXEUFyZRD", + "id":"5d4b6464-50b0-4234-8de6-1f74a836329a", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors":[ + { + "idShort":"newIdShortInUpdateRequest", + "id":"c00b94ac-9e91-4f04-848c-9fa5b287a6ac", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[ + { + "language":"cn", + "text":"chinese" + } + ], + "displayName":[ + + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/request.json new file mode 100644 index 00000000..53ee0429 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/19_testUpdateSubmodelWithDifferentIdInPayloadExpectPathIdisTaken/4_get_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/NWQ0YjY0NjQtNTBiMC00MjM0LThkZTYtMWY3NGE4MzYzMjlh", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..39ca86d5 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,160 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"Ndy9Ca6jdf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6f7e", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWbvXIcV", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbf4d41", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..e9d84769 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/1_post_shell/request.json @@ -0,0 +1,160 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"Ndy9Ca6jdf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6f7e", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWbvXIcV", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbf4d41", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/expected-response.json new file mode 100644 index 00000000..a19cdb02 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/expected-response.json @@ -0,0 +1,10 @@ +{ + "status": 200, + "content": true, + "assertions": [{ + "jsonPath": "$.result", + "exists": true + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/request.json new file mode 100644 index 00000000..22558679 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/2_get_shells/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..fb10642b --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/expected-response.json @@ -0,0 +1,160 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"Ndy9Ca6jdf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6f7e", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWbvXIcV", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbf4d41", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/request.json new file mode 100644 index 00000000..f0d70c06 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/1_testCreateShellExpectSuccess/3_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/NjYyYmI4ZmYtMDg0My00MmQzLWFiY2UtMjIyNGFkNWQ2Zjdl", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..92f5ea31 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"GziSpdMDfU", + "id":"e4ffc3ef-6fd9-4549-87c3-0b65b55a00be", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..7b5feeed --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"GziSpdMDfU", + "id":"e4ffc3ef-6fd9-4549-87c3-0b65b55a00be", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..93c427f4 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,42 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "idShort":"GziSpdMDfU", + "id":"574e43bc-5c14-449a-afec-bd82d029573f", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..c05f4fc4 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/ZTRmZmMzZWYtNmZkOS00NTQ5LTg3YzMtMGI2NWI1NWEwMGJl/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"GziSpdMDfU", + "id":"574e43bc-5c14-449a-afec-bd82d029573f", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json new file mode 100644 index 00000000..e4b8c1f5 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/expected-response.json @@ -0,0 +1,15 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.submodelDescriptors", + "hasSize": 1 + }, + { + "jsonPath": "$.submodelDescriptors[*].id", + "hasItem": "574e43bc-5c14-449a-afec-bd82d029573f" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/request.json new file mode 100644 index 00000000..a34b15c7 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/3_get_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/shell-descriptors/ZTRmZmMzZWYtNmZkOS00NTQ5LTg3YzMtMGI2NWI1NWEwMGJl", + "tenant": "TENANT_ONE", + "method":"GET", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/expected-response.json new file mode 100644 index 00000000..3371de1a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/expected-response.json @@ -0,0 +1,6 @@ +{ + "status": 204, + "content": false, + "assertions": [], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/request.json new file mode 100644 index 00000000..c6e7f99e --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/4_delete_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/shell-descriptors/ZTRmZmMzZWYtNmZkOS00NTQ5LTg3YzMtMGI2NWI1NWEwMGJl/submodel-descriptors/NTc0ZTQzYmMtNWMxNC00NDlhLWFmZWMtYmQ4MmQwMjk1NzNm", + "tenant": "TENANT_ONE", + "method":"DELETE", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/expected-response.json new file mode 100644 index 00000000..dd90bd8f --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/expected-response.json @@ -0,0 +1,11 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.submodelDescriptors", + "hasSize": 0 + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/request.json new file mode 100644 index 00000000..a34b15c7 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/20_testDeleteSubmodelExpectSuccess/5_get_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/shell-descriptors/ZTRmZmMzZWYtNmZkOS00NTQ5LTg3YzMtMGI2NWI1NWEwMGJl", + "tenant": "TENANT_ONE", + "method":"GET", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/expected-response.json new file mode 100644 index 00000000..72b517ac --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"GziSpdMDdd", + "id":"ac6783b9-700d-4ba5-9b3c-570593f862b0", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/request.json new file mode 100644 index 00000000..e70f2465 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"GziSpdMDdd", + "id":"ac6783b9-700d-4ba5-9b3c-570593f862b0", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..9caee4b3 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,42 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "idShort":"GziSpdccdcd", + "id":"607ac7fa-2712-44c4-97aa-03ddfbdf2c3f", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..8b1d518a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/YWM2NzgzYjktNzAwZC00YmE1LTliM2MtNTcwNTkzZjg2MmIw/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"GziSpdccdcd", + "id":"607ac7fa-2712-44c4-97aa-03ddfbdf2c3f", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/expected-response.json new file mode 100644 index 00000000..df33c831 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/expected-response.json @@ -0,0 +1,9 @@ +{ + "status": 404, + "content": true, + "assertions": [{ + "jsonPath": "$.messages[0].text", + "equals": "Submodel for identifier e0e19658-ae95-437c-a89c-f9b76d987fd5 not found." + }], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/request.json new file mode 100644 index 00000000..bfb13097 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/21_testDeleteSubmodelExpectNotFound/3_delete_shell_descriptors/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/shell-descriptors/YWM2NzgzYjktNzAwZC00YmE1LTliM2MtNTcwNTkzZjg2MmIw/submodel-descriptors/ZTBlMTk2NTgtYWU5NS00MzdjLWE4OWMtZjliNzZkOTg3ZmQ1", + "tenant": "TENANT_ONE", + "method":"DELETE", + "body": null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/expected-response.json new file mode 100644 index 00000000..9bea4b5c --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/expected-response.json @@ -0,0 +1,9 @@ +{ + "status": 400, + "content": true, + "assertions": [{ + "jsonPath": "$.messages[0].text", + "equals": "Incorrect Base64 encoded value provided as parameter" + }], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/request.json new file mode 100644 index 00000000..94b5e929 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/22_testLookupApiWithInvalidQueryParameterExpectFailure/1_get_lookup_shells/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/lookup/shells?assetIds=%7B%20invalid%20%7D", + "tenant": "TENANT_ONE", + "method":"GET", + "body":null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/expected-response.json new file mode 100644 index 00000000..c3e92aac --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/expected-response.json @@ -0,0 +1,9 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "paging_metadata": {}, + "result": [] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/request.json new file mode 100644 index 00000000..a6200279 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/23_testLookUpApiWithMultiParamIds/1_get_lookup_shells/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/lookup/shells?assetIds=eyJuYW1lIjoiaWRlbnRpZmllcjFLZXlFeGFtcGxlIiwidmFsdWUiOiJpZGVudGlmaWVyMVZhbHVlRXhhbXBsZSJ9&assetIds=eyJuYW1lIjoiaWRlbnRpZmllcjFLZXlFeGFtcGxlIiwidmFsdWUiOiJpZGVudGlmaWVyMVZhbHVlRXhhbXBsZSJ9", + "tenant": "TENANT_ONE", + "method":"GET", + "body":null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..170431f5 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"dkghvbfz2", + "id":"79bf1b0c-0be0-412f-83f2-02eb9ab04180", + "specificAssetIds":[ + { + "name":"id1", + "value":"value1" + }, + { + "name":"id2", + "value":"value2" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..80f632e0 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"dkghvbfz2", + "id":"79bf1b0c-0be0-412f-83f2-02eb9ab04180", + "specificAssetIds":[ + { + "name":"id1", + "value":"value1" + }, + { + "name":"id2", + "value":"value2" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/expected-response.json new file mode 100644 index 00000000..debfdf95 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"Ahfdkfz3f", + "id":"ae21fc16-fc41-48fd-befb-ca72a6825dec", + "specificAssetIds":[ + { + "name":"id1", + "value":"value1" + }, + { + "name":"id2", + "value":"value2" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/request.json new file mode 100644 index 00000000..2bf57eec --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/2_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"Ahfdkfz3f", + "id":"ae21fc16-fc41-48fd-befb-ca72a6825dec", + "specificAssetIds":[ + { + "name":"id1", + "value":"value1" + }, + { + "name":"id2", + "value":"value2" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/expected-response.json new file mode 100644 index 00000000..7034d078 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/expected-response.json @@ -0,0 +1,15 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.paging_metadata.cursor", + "exists": true + }, + { + "jsonPath": "$.result", + "hasSize": 1 + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/request.json new file mode 100644 index 00000000..1242ac1a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/3_get_lookup_shells/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/lookup/shells?limit=1&assetIds=eyJuYW1lIjoiaWQxIiwidmFsdWUiOiJ2YWx1ZTEifQ==", + "tenant": "TENANT_ONE", + "method":"GET", + "body":null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/expected-response.json new file mode 100644 index 00000000..551266ca --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/expected-response.json @@ -0,0 +1,23 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.paging_metadata", + "isEmpty": true + }, + { + "jsonPath": "$.result", + "hasSize": 2 + }, + { + "jsonPath": "$.result", + "hasItem": "79bf1b0c-0be0-412f-83f2-02eb9ab04180" + }, + { + "jsonPath": "$.result", + "hasItem": "ae21fc16-fc41-48fd-befb-ca72a6825dec" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/request.json new file mode 100644 index 00000000..7fde500b --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/24_testFindExternalShellIdsBySpecificAssetIdsExpectSuccess/4_get_lookup_shells/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/lookup/shells?assetIds=eyJuYW1lIjoiaWQxIiwidmFsdWUiOiJ2YWx1ZTEifQ==", + "tenant": "TENANT_ONE", + "method":"GET", + "body":null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..cde8789e --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"WuLt0C2e5v", + "id":"24953458-7bd0-40b8-888f-3191d8d6af26", + "specificAssetIds":[ + { + "name":"id1-25", + "value":"value1-25" + }, + { + "name":"id2-25", + "value":"value2-25" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..db5afb4a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "description":[], + "displayName":[], + "idShort":"WuLt0C2e5v", + "id":"24953458-7bd0-40b8-888f-3191d8d6af26", + "specificAssetIds":[ + { + "name":"id1-25", + "value":"value1-25" + }, + { + "name":"id2-25", + "value":"value2-25" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/expected-response.json new file mode 100644 index 00000000..f500dc9d --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/expected-response.json @@ -0,0 +1,21 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"mQc8uRgfA9", + "id":"a8df7bb0-9ddf-4791-989d-539bb6862322", + "specificAssetIds":[ + { + "name":"id1-25", + "value":"value1-25" + }, + { + "name":"id2-25", + "value":"value2-25" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/request.json new file mode 100644 index 00000000..a5a8dc0d --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/2_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "description":[], + "displayName":[], + "idShort":"mQc8uRgfA9", + "id":"a8df7bb0-9ddf-4791-989d-539bb6862322", + "specificAssetIds":[ + { + "name":"id1-25", + "value":"value1-25" + }, + { + "name":"id2-25", + "value":"value2-25" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/expected-response.json new file mode 100644 index 00000000..7034d078 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/expected-response.json @@ -0,0 +1,15 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.paging_metadata.cursor", + "exists": true + }, + { + "jsonPath": "$.result", + "hasSize": 1 + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/request.json new file mode 100644 index 00000000..c4aacaad --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/3_post_lookup_shells/request.json @@ -0,0 +1,11 @@ +{ + "url":"/api/v3/lookup/shellsByAssetLink?limit=1", + "tenant": "TENANT_ONE", + "method":"POST", + "body":[ + { + "name": "id1-25", + "value": "value1-25" + } + ] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/expected-response.json new file mode 100644 index 00000000..70b3023f --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/expected-response.json @@ -0,0 +1,23 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.paging_metadata", + "isEmpty": true + }, + { + "jsonPath": "$.result", + "hasSize": 2 + }, + { + "jsonPath": "$.result", + "hasItem": "24953458-7bd0-40b8-888f-3191d8d6af26" + }, + { + "jsonPath": "$.result", + "hasItem": "a8df7bb0-9ddf-4791-989d-539bb6862322" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/request.json new file mode 100644 index 00000000..2aae0920 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/25_testFindExternalShellIdsByAssetLinkExpectSuccess/4_post_lookup_shells/request.json @@ -0,0 +1,11 @@ +{ + "url":"/api/v3/lookup/shellsByAssetLink?limit=10", + "tenant": "TENANT_ONE", + "method":"POST", + "body":[ + { + "name": "id1-25", + "value": "value1-25" + } + ] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..785170f9 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,13 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "globalAssetId": "ea83b370-522a-4bbd-b451-fbe15a77706d", + "idShort":"KfI9Rcfvvy", + "id":"804cae7d-8a5f-436c-a78f-f312c30159dd", + "specificAssetIds":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..02e39537 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/1_post_shell/request.json @@ -0,0 +1,13 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "description":[], + "displayName":[], + "globalAssetId": "ea83b370-522a-4bbd-b451-fbe15a77706d", + "idShort":"KfI9Rcfvvy", + "id":"804cae7d-8a5f-436c-a78f-f312c30159dd", + "specificAssetIds":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/expected-response.json new file mode 100644 index 00000000..713a02c8 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/expected-response.json @@ -0,0 +1,19 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.paging_metadata", + "isEmpty": true + }, + { + "jsonPath": "$.result", + "hasSize": 1 + }, + { + "jsonPath": "$.result", + "hasItem": "804cae7d-8a5f-436c-a78f-f312c30159dd" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/request.json new file mode 100644 index 00000000..a077a30c --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/26_testFindExternalShellIdByGlobalAssetIdExpectSuccess/2_get_lookup_shells/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/lookup/shells?&assetIds=eyJuYW1lIjoiZ2xvYmFsQXNzZXRJZCIsInZhbHVlIjoiZWE4M2IzNzAtNTIyYS00YmJkLWI0NTEtZmJlMTVhNzc3MDZkIn0", + "tenant": "TENANT_ONE", + "method":"GET", + "body":null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..9d1b07f1 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,13 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "globalAssetId": "e556db2f-2248-40b4-b994-baf6d98d8f0d", + "idShort":"xDIekygF1W", + "id":"eb321464-a81f-4d4c-a7af-f6ca79bcab5b", + "specificAssetIds":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..8d69aaa5 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/1_post_shell/request.json @@ -0,0 +1,13 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "description":[], + "displayName":[], + "globalAssetId": "e556db2f-2248-40b4-b994-baf6d98d8f0d", + "idShort":"xDIekygF1W", + "id":"eb321464-a81f-4d4c-a7af-f6ca79bcab5b", + "specificAssetIds":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/expected-response.json new file mode 100644 index 00000000..39a88e9c --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/expected-response.json @@ -0,0 +1,19 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.paging_metadata", + "isEmpty": true + }, + { + "jsonPath": "$.result", + "hasSize": 1 + }, + { + "jsonPath": "$.result", + "hasItem": "eb321464-a81f-4d4c-a7af-f6ca79bcab5b" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/request.json new file mode 100644 index 00000000..fd34ec71 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/27_testFindExternalShellIdByGlobalAssetIdAssetLinkExpectSuccess/2_post_lookup_shells/request.json @@ -0,0 +1,11 @@ +{ + "url":"/api/v3/lookup/shellsByAssetLink", + "tenant": "TENANT_ONE", + "method":"POST", + "body":[ + { + "name": "globalAssetId", + "value": "e556db2f-2248-40b4-b994-baf6d98d8f0d" + } + ] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/expected-response.json new file mode 100644 index 00000000..6a6033ee --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/expected-response.json @@ -0,0 +1,6 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": {} +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/request.json new file mode 100644 index 00000000..c354a7d2 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/28_testFindExternalShellIdsWithoutProvidingQueryParametersExpectEmptyResult/1_get_lookup_shells/request.json @@ -0,0 +1,6 @@ +{ + "url":"/api/v3/lookup/shells", + "tenant": "TENANT_ONE", + "method":"GET", + "body":null +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..2ef17cba --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,49 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "id":"442a154e-05dd-460a-be11-47c147074482", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "id":"f313db25-78e4-4435-ad77-6ace3d08fd0f", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..7196124a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/1_post_shell/request.json @@ -0,0 +1,51 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":null, + "id":"442a154e-05dd-460a-be11-47c147074482", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": null, + "id":"f313db25-78e4-4435-ad77-6ace3d08fd0f", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..77ef44c4 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/expected-response.json @@ -0,0 +1,49 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "id":"442a154e-05dd-460a-be11-47c147074482", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "id":"f313db25-78e4-4435-ad77-6ace3d08fd0f", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/request.json new file mode 100644 index 00000000..ea3ba5a3 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/29_testCreateShellWithEmptyIdShortExpectSuccess/2_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/NDQyYTE1NGUtMDVkZC00NjBhLWJlMTEtNDdjMTQ3MDc0NDgy", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/expected-response.json new file mode 100644 index 00000000..8722b8da --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/expected-response.json @@ -0,0 +1,10 @@ +{ + "status": 400, + "content": true, + "assertions": [ + { + "jsonPath": "$.messages[0].text", + "equals": "must match \"^([\\x09\\x0a\\x0d\\x20-\\ud7ff\\ue000-\\ufffd]|\\ud800[\\udc00-\\udfff]|[\\ud801-\\udbfe][\\udc00-\\udfff]|\\udbff[\\udc00-\\udfff])*$\"" + } + ] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/request.json new file mode 100644 index 00000000..66ff6838 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/2_testCreateShellExpectRegexError/1_post_shell/request.json @@ -0,0 +1,160 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType \u0000", + "globalAssetId":"globalAssetId example", + "idShort":"pXQsJNAB64", + "id":"375c1f38-0ada-4fe3-8614-6eef35e5cf3f", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"sUT8hnoCQR", + "id":"540cd28a-9278-46f9-a563-657969f55dc9", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..dfb1498a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,50 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "id":"d6b20766-31d9-4238-b82a-5bc66f2fab24", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "wR3uvFxS3N", + "id":"ff4788e7-a077-407e-90e7-2e9053f375b7", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..72caab6f --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json @@ -0,0 +1,51 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":null, + "id":"d6b20766-31d9-4238-b82a-5bc66f2fab24", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "wR3uvFxS3N", + "id":"ff4788e7-a077-407e-90e7-2e9053f375b7", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..a6b8f94c --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json @@ -0,0 +1,50 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "id":"d6b20766-31d9-4238-b82a-5bc66f2fab24", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "wR3uvFxS3N", + "id":"ff4788e7-a077-407e-90e7-2e9053f375b7", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json new file mode 100644 index 00000000..8685a13b --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/30_testCreateShellWithEmptyIdShortAndValidIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/ZDZiMjA3NjYtMzFkOS00MjM4LWI4MmEtNWJjNjZmMmZhYjI0", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..28c1f27b --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,50 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"CYFlZalx6j", + "id":"9dd90727-09a8-4788-9c50-332f6e5465f9", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "id":"89afe357-2804-4ada-add6-e0d52921384b", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..40864fb9 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/1_post_shell/request.json @@ -0,0 +1,51 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":"CYFlZalx6j", + "id":"9dd90727-09a8-4788-9c50-332f6e5465f9", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": null, + "id":"89afe357-2804-4ada-add6-e0d52921384b", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..6d3822c5 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/expected-response.json @@ -0,0 +1,50 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"CYFlZalx6j", + "id":"9dd90727-09a8-4788-9c50-332f6e5465f9", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "id":"89afe357-2804-4ada-add6-e0d52921384b", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json new file mode 100644 index 00000000..9208b39b --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/31_testCreateShellWithIdShortAndEmptyIdShortInSubmodelDescriptorsExpectSuccess/2_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/OWRkOTA3MjctMDlhOC00Nzg4LTljNTAtMzMyZjZlNTQ2NWY5", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/expected-response.json new file mode 100644 index 00000000..bee5b7db --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/expected-response.json @@ -0,0 +1,12 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"1QvyTYoAE9", + "id":"9da9f810-bf6b-418a-b232-f6df2d94cac3", + "specificAssetIds":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/request.json new file mode 100644 index 00000000..e1e84837 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/1_post_shell/request.json @@ -0,0 +1,12 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":"1QvyTYoAE9", + "id":"9da9f810-bf6b-418a-b232-f6df2d94cac3", + "specificAssetIds":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/expected-response.json new file mode 100644 index 00000000..ae487a43 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/expected-response.json @@ -0,0 +1,9 @@ +{ + "status": 400, + "content": true, + "assertions": [{ + "jsonPath": "$.messages[0].text", + "equals": "An AssetAdministrationShell for the given IdShort already exists." + }], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/request.json new file mode 100644 index 00000000..5dbeb300 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/32_testCreateShellWithDuplicateIdShortExpectBadRequest/2_post_shell/request.json @@ -0,0 +1,12 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":"1QvyTYoAE9", + "id":"5125c0df-2613-4181-a054-396bd1135e7b", + "specificAssetIds":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/expected-response.json new file mode 100644 index 00000000..dab72dad --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/expected-response.json @@ -0,0 +1,9 @@ +{ + "status": 400, + "content": true, + "assertions": [{ + "jsonPath": "$.messages[0].text", + "equals": "An AssetAdministration Submodel for the given IdShort does already exists." + }], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/request.json new file mode 100644 index 00000000..ecf0081e --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/33_testCreateShellWithUniqueIdShortAndDuplicateIdShortSubmodelDescriptorsExpectBadRequest/1_post_shell/request.json @@ -0,0 +1,88 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":"ZyhaNaVQSg", + "id":"ccb41986-822f-48b7-b480-25b446587758", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "xMokaIYQhF", + "id":"7ba44100-433f-4c33-a4db-44a5bb575b1d", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + }, + { + "idShort": "xMokaIYQhF", + "id":"d8487f64-30d0-4cbb-9bc9-4572de5ff599", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..e95d05fd --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,51 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"cqvfyzzTKA", + "id":"c2499292-e18f-42a7-82fa-acadd1478862", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "MNukhLY49J", + "id":"1cdeb2b9-f6f6-4d90-b0ed-2f14a618e866", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..a8f90f2d --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/1_post_shell/request.json @@ -0,0 +1,51 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":"cqvfyzzTKA", + "id":"c2499292-e18f-42a7-82fa-acadd1478862", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "MNukhLY49J", + "id":"1cdeb2b9-f6f6-4d90-b0ed-2f14a618e866", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..e6aadb68 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,42 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "idShort":"9caszUXoCN", + "id":"80040c46-4113-4028-a76c-1cc230e42d19", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..1dcd5837 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/YzI0OTkyOTItZTE4Zi00MmE3LTgyZmEtYWNhZGQxNDc4ODYy/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"9caszUXoCN", + "id":"80040c46-4113-4028-a76c-1cc230e42d19", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..facef0ac --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/expected-response.json @@ -0,0 +1,88 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"cqvfyzzTKA", + "id":"c2499292-e18f-42a7-82fa-acadd1478862", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "MNukhLY49J", + "id":"1cdeb2b9-f6f6-4d90-b0ed-2f14a618e866", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + }, + { + "idShort":"9caszUXoCN", + "id":"80040c46-4113-4028-a76c-1cc230e42d19", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/request.json new file mode 100644 index 00000000..335a4f73 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/34_testCreateNewSubmodelDescriptorsWithUniqueIdShortExpectSuccess/3_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/YzI0OTkyOTItZTE4Zi00MmE3LTgyZmEtYWNhZGQxNDc4ODYy", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/expected-response.json new file mode 100644 index 00000000..db0232f0 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/expected-response.json @@ -0,0 +1,51 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"mSNO5xAUAE", + "id":"672b558f-2f92-4994-a3d3-f9c4f1120ef3", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "CgtP2OAGSt", + "id":"e61cb6fc-f760-4e5c-a9d7-ce0f6e1a5e7a", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/request.json new file mode 100644 index 00000000..0dd753fc --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/1_post_shell/request.json @@ -0,0 +1,51 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[], + "displayName":[], + "idShort":"mSNO5xAUAE", + "id":"672b558f-2f92-4994-a3d3-f9c4f1120ef3", + "specificAssetIds":[], + "submodelDescriptors":[ + { + "idShort": "CgtP2OAGSt", + "id":"e61cb6fc-f760-4e5c-a9d7-ce0f6e1a5e7a", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/expected-response.json new file mode 100644 index 00000000..dab72dad --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/expected-response.json @@ -0,0 +1,9 @@ +{ + "status": 400, + "content": true, + "assertions": [{ + "jsonPath": "$.messages[0].text", + "equals": "An AssetAdministration Submodel for the given IdShort does already exists." + }], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/request.json new file mode 100644 index 00000000..1d9c6935 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/35_testCreateSubmodelDescriptorsWithDuplicateIdShortBadRequest/2_post_submodel_descriptors/request.json @@ -0,0 +1,42 @@ +{ + "url":"/api/v3/shell-descriptors/NjcyYjU1OGYtMmY5Mi00OTk0LWEzZDMtZjljNGYxMTIwZWYz/submodel-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body": { + "idShort":"CgtP2OAGSt", + "id":"1745689f-fed6-4f17-9c41-18c75b777ebc", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/expected-response.json new file mode 100644 index 00000000..0954fcd1 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/expected-response.json @@ -0,0 +1,11 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.profiles[0]", + "equals": "https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRegistryServiceSpecification/SSP-001" + } + ], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/request.json new file mode 100644 index 00000000..17a2a861 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/36_testGetDescriptionExpectSuccess/1_get_description/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/description", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/expected-response.json new file mode 100644 index 00000000..6c9e5238 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/expected-response.json @@ -0,0 +1,10 @@ +{ + "status": 400, + "content": true, + "assertions": [ + { + "jsonPath": "$.messages[0].text", + "equals": "An AssetAdministrationShell for the given identification does already exists." + } + ] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/request.json new file mode 100644 index 00000000..e9d84769 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/3_testCreateShellWithExistingIdExpectBadRequest/1_post_shell/request.json @@ -0,0 +1,160 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"Ndy9Ca6jdf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6f7e", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWbvXIcV", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbf4d41", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..55913bf9 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,160 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"KI02OAR1I3", + "id":"b00b6e97-19ba-471d-bfa0-03ce1dd506a4", + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "idShort":"R1hWbvXIcV", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbf4d42", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..64f50539 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/1_post_shell/request.json @@ -0,0 +1,160 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"KI02OAR1I3", + "id":"b00b6e97-19ba-471d-bfa0-03ce1dd506a4", + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "idShort":"R1hWbvXIcV", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbf4d42", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..926a3848 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/expected-response.json @@ -0,0 +1,160 @@ +{ + "status": 200, + "content": true, + "assertions": [], + "expectedPayload": { + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"KI02OAR1I3", + "id":"b00b6e97-19ba-471d-bfa0-03ce1dd506a4", + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "idShort":"R1hWbvXIcV", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbf4d42", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/request.json new file mode 100644 index 00000000..8b9cd863 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/4_testGetShellExpectSuccess/2_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/YjAwYjZlOTctMTliYS00NzFkLWJmYTAtMDNjZTFkZDUwNmE0", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..ab1ab015 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/expected-response.json @@ -0,0 +1,5 @@ +{ + "status": 404, + "content": false, + "assertions": [] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/request.json new file mode 100644 index 00000000..693d03d8 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/5_testGetShellExpectNotFound/1_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/NotExistingShellId", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..13ad7923 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,160 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"NDfECad2wf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6dh4", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWkFp3GA", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfsf31", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..50621eb8 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/1_post_shell/request.json @@ -0,0 +1,160 @@ +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "POST", + "body": { + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"NDfECad2wf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6dh4", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWkFp3GA", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfsf31", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/expected-response.json new file mode 100644 index 00000000..3371de1a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/expected-response.json @@ -0,0 +1,6 @@ +{ + "status": 204, + "content": false, + "assertions": [], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/request.json new file mode 100644 index 00000000..0eaedc9f --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/2_update_shell/request.json @@ -0,0 +1,160 @@ +{ + "url": "/api/v3/shell-descriptors/NjYyYmI4ZmYtMDg0My00MmQzLWFiY2UtMjIyNGFkNWQ2ZGg0", + "tenant": "TENANT_ONE", + "method": "PUT", + "body": { + "description":[ + { + "language":"fr", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"fr", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"NDfECad2wf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6dh4", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWkFp3GA", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfsf31", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..41a13a09 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/expected-response.json @@ -0,0 +1,10 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.displayName[0].language", + "equals": "fr" + } + ] +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/request.json new file mode 100644 index 00000000..49b069a6 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/6_testUpdateShellExpectSuccess/3_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/NjYyYmI4ZmYtMDg0My00MmQzLWFiY2UtMjIyNGFkNWQ2ZGg0", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/expected-response.json new file mode 100644 index 00000000..f7bc7957 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/expected-response.json @@ -0,0 +1,10 @@ +{ + "status": 404, + "content": true, + "assertions": [ + { + "jsonPath": "$.messages[0].text", + "equals": "Shell for identifier shellIdthatdoesnotexists not found" + } + ] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/request.json new file mode 100644 index 00000000..4b2130cd --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/7_testUpdateShellExpectNotFound/1_update_shell_by_id/request.json @@ -0,0 +1,160 @@ +{ + "url": "/api/v3/shell-descriptors/c2hlbGxJZHRoYXRkb2Vzbm90ZXhpc3Rz", + "tenant": "TENANT_ONE", + "method": "PUT", + "body": { + "description":[ + { + "language":"fr", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"fr", + "text":"this is an example description1" + } + ], + "assetKind":"Instance", + "assetType":"AssetType", + "globalAssetId":"globalAssetId example", + "idShort":"NDfECad2wf", + "id":"662bb8ff-0843-42d3-abce-2224ad5d6dh4", + "specificAssetIds":[ + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier1KeyExample", + "value":"identifier1ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + }, + { + "semanticId":{ + "type":"ModelReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"specificAssetIdReference key" + } + ] + }, + "supplementalSemanticIds":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"BasicEventElement", + "value":"assetIdKey value" + } + ] + } + ], + "name":"identifier2KeyExample", + "value":"identifier2ValueExample", + "externalSubjectId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"AssetAdministrationShell", + "value":"ExternalSubject key value" + } + ] + } + } + ], + "submodelDescriptors":[ + { + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "e" + ], + "subprotocol":"subprotocolExample", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "idShort":"R1hWkFp3GA", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfsf31", + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "supplementalSemanticId":[ + { + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"supplementalsemanticIdExample value" + } + ] + } + ], + "description":[ + { + "language":"de", + "text":"hello text" + }, + { + "language":"en", + "text":"hello s" + } + ], + "displayName":[ + { + "language":"de", + "text":"this is an example description1" + } + ] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/expected-response.json new file mode 100644 index 00000000..f3b773ed --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/expected-response.json @@ -0,0 +1,60 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[], + "displayName":[], + "idShort":"NDfECad34g", + "id":"662bb8ff-0843-42d3-abce-2224ad5dfreA", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors":[ + { + "idShort":"R1hWkFp3DA", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfDsga", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/request.json new file mode 100644 index 00000000..ef9452c6 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/1_post_shell/request.json @@ -0,0 +1,60 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"NDfECad34g", + "id":"662bb8ff-0843-42d3-abce-2224ad5dfreA", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors":[ + { + "idShort":"R1hWkFp3DA", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfDsga", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/expected-response.json new file mode 100644 index 00000000..3371de1a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/expected-response.json @@ -0,0 +1,6 @@ +{ + "status": 204, + "content": false, + "assertions": [], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/request.json new file mode 100644 index 00000000..4d4d9a83 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/2_update_shell/request.json @@ -0,0 +1,60 @@ +{ + "url": "/api/v3/shell-descriptors/NjYyYmI4ZmYtMDg0My00MmQzLWFiY2UtMjIyNGFkNWRmcmVB", + "tenant": "TENANT_ONE", + "method": "PUT", + "body": { + "description":[], + "displayName":[], + "idShort":"newIdShortInUpdateRequest", + "id":"newShellIdShouldIgnore", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors":[ + { + "idShort":"ChangeSubmodelIdShort", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfDsga", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/expected-response.json new file mode 100644 index 00000000..8273e50c --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/expected-response.json @@ -0,0 +1,14 @@ +{ + "status": 200, + "content": true, + "assertions": [ + { + "jsonPath": "$.id", + "equals": "662bb8ff-0843-42d3-abce-2224ad5dfreA" + }, + { + "jsonPath": "$.submodelDescriptors[0].idShort", + "equals": "ChangeSubmodelIdShort" + } + ] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/request.json new file mode 100644 index 00000000..8bf24466 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/8_testUpdateShellWithDifferentIdInPayloadExpectPathIdIsTaken/3_get_shell_by_id/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/NjYyYmI4ZmYtMDg0My00MmQzLWFiY2UtMjIyNGFkNWRmcmVB", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/expected-response.json new file mode 100644 index 00000000..50ae77aa --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/expected-response.json @@ -0,0 +1,25 @@ +{ + "status": 201, + "content": true, + "assertions": [], + "expectedPayload": { + "description":[ + + ], + "displayName":[ + + ], + "idShort":"NDfESdWas3", + "id":"34d4428e-953c-48b4-9ae2-15b69cf0cacd", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/request.json new file mode 100644 index 00000000..9496eaa6 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/1_post_shell/request.json @@ -0,0 +1,21 @@ +{ + "url":"/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method":"POST", + "body":{ + "description":[], + "displayName":[], + "idShort":"NDfESdWas3", + "id":"34d4428e-953c-48b4-9ae2-15b69cf0cacd", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ] + } +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/expected-response.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/expected-response.json new file mode 100644 index 00000000..3371de1a --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/expected-response.json @@ -0,0 +1,6 @@ +{ + "status": 204, + "content": false, + "assertions": [], + "expectedPayload": null +} diff --git a/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/request.json b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/request.json new file mode 100644 index 00000000..af478130 --- /dev/null +++ b/backend/src/test/resources/integrationtests/aas-registry-usecases/9_testDeleteShellExpectSuccess/2_delete_shell/request.json @@ -0,0 +1,6 @@ +{ + "url": "/api/v3/shell-descriptors/MzRkNDQyOGUtOTUzYy00OGI0LTlhZTItMTViNjljZjBjYWNk", + "tenant": "TENANT_ONE", + "method": "DELETE", + "body": null +} diff --git a/backend/src/test/resources/integrationtests/shell-descriptors-req-template.json b/backend/src/test/resources/integrationtests/shell-descriptors-req-template.json new file mode 100644 index 00000000..96988da9 --- /dev/null +++ b/backend/src/test/resources/integrationtests/shell-descriptors-req-template.json @@ -0,0 +1,37 @@ +{ + "idShort":"jN63MqLLo0", + "id":"6592fefe-d9ba-4d63-9238-d353e44f840a", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] +} \ No newline at end of file diff --git a/backend/src/test/resources/integrationtests/shell-with-min-req-template.json b/backend/src/test/resources/integrationtests/shell-with-min-req-template.json new file mode 100644 index 00000000..f3e039ab --- /dev/null +++ b/backend/src/test/resources/integrationtests/shell-with-min-req-template.json @@ -0,0 +1,55 @@ +{ + "description":[], + "displayName":[], + "idShort":"NDfECad34g", + "id":"662bb8ff-0843-42d3-abce-2224ad5dfreA", + "specificAssetIds":[ + { + "name":"identifier1KeyExample", + "value":"identifier1ValueExample" + }, + { + "name":"identifier2KeyExample", + "value":"identifier2ValueExample" + } + ], + "submodelDescriptors":[ + { + "idShort":"R1hWkFp3DA", + "id":"ba616af0-9d3c-4620-a2eb-428b3fbfDsga", + "endpoints":[ + { + "interface":"interfaceNameExample", + "protocolInformation":{ + "href":"http://endpoint-address", + "endpointProtocol":"endpointProtocolExample", + "endpointProtocolVersion":[ + "1.1" + ], + "subprotocol":"", + "subprotocolBody":"subprotocolBodyExample", + "subprotocolBodyEncoding":"subprotocolBodyExample", + "securityAttributes":[ + { + "type":"NONE", + "key":"Security Attribute key", + "value":"Security Attribute value" + } + ] + } + } + ], + "semanticId":{ + "type":"ExternalReference", + "keys":[ + { + "type":"Submodel", + "value":"semanticIdExample" + } + ] + }, + "description":[], + "displayName":[] + } + ] +} \ No newline at end of file diff --git a/docs/development/guideline-integrationtests.md b/docs/development/guideline-integrationtests.md new file mode 100755 index 00000000..a55ab8ae --- /dev/null +++ b/docs/development/guideline-integrationtests.md @@ -0,0 +1,179 @@ +# Guideline to use/add usecase for integration tests +This documentation outlines the structure and conventions used in the integration tests for the application. + +## Test location +All integration testcases are localized under the following directory: +`` +src/test/resources/integrationtests +`` + +## Test structure +Each usecase for integration testing has its own directory within the integrationtests folder. +Each directory is named according to the specific usecase tests and contains subdirectories that represent individual actions within the use case. +The general structure is as follows: +``` +integrationtests + aas-registry-usecases/ + │ + └───usecase1/ + │ │ + │ └───1_action/ + │ │ │ request.json + │ │ │ expected-response.json + │ │ + │ └───2_action/ + │ │ request.json + │ │ expected-response.json + │ + └───usecase2/ + │ + (similar structure as usecase1) + (similar structure as aas-registry-usecases)/ +``` + +## Description of Directory and Files +### Usecase Directory +Each use case has a dedicated directory (usecase1, etc.) . This directory may contain multiple action directories. + +### Action Directory +Inside each use case directory, there are subdirectories for each action. +Each action directory corresponds to a specific step or operation within the use case. +Number the actions so that they are performed sequentially. + +### Files +#### request.json +This file contains the JSON-formatted request payload that is sent to the system being tested. It should accurately represent the input the system will receive during the test. +The json has the following parameters: + +| Field | Description | +|----------|---------------------------------------| +| `url` | URL of the API | +| `tenant` | EDC-BPN which will perform the request| +| `method` | Method type (POST, DELETE, GET, UPDATE) | +| `body` | request body | + +Example request.json file: +```json +{ + "url": "/api/v3/shell-descriptors", + "tenant": "TENANT_ONE", + "method": "GET", + "body": null +} +``` + +#### expected-response.json +This file contains the JSON-formatted expected response from the system, which will be used to validate the system's output against what is expected. +The json has the following parameters: + +| Field | Description | +|------------------|-------------------------------------| +| `status` | response code | +| `content` | True if content needs to be compared| +| `assertions` | Type of assertions | +| `expectedPayload`| Compare the payload | + +Example expected-response.json file: +```json +{ + "status": 200, + "content": true, + "assertions": [{ + "jsonPath": "$.result", + "exists": true + } + ], + "expectedPayload": null +} +``` + +Following assertions can be used for compare the response: + +**exists:** +Check if path exists (true/false) +```json +{ + "jsonPath": "$.result", + "exists": true +} +``` + +**equals:** +Check if path equals value: +```json +{ + "jsonPath": "$.messages[0].text", + "equals": "Incorrect Base64 encoded value provided as parameter" +} +``` + +**hasSize:** +Check if a list has defined size: +```json +{ + "jsonPath": "$.submodelDescriptors", + "hasSize": 0 +} +``` + +**contains:** +Check if a path contains value: +```json +{ + "jsonPath": "$.messages[0].text", + "contains": "value" +} +``` + +**doesNotExist:** +Check if a path does not exists: +```json +{ + "jsonPath": "$.messages[0].text", + "doesNotExist": false +} +``` + +**hasItem:** +Check if a path has item: +```json +{ + "jsonPath": "$.submodelDescriptors[*].id", + "hasItem": "574e43bc-5c14-449a-afec-bd82d029573f" +} +``` + +**isEmpty:** +Check if a path is empty: +```json +{ + "jsonPath": "$.paging_metadata", + "isEmpty": true +} +``` + +**isNotEmpty:** +Check if a path is not empty: +```json +{ + "jsonPath": "$.paging_metadata", + "isNotEmpty": false +} +``` + +## Add new tests +When adding tests, follow these steps to maintain consistency: +1. Identify Use Cases: Start by identifying all the use cases that need to be tested. Each use case should correspond to a specific flow or feature of the application. +2. Define Actions: Break down each use case into discrete actions. Each action should represent a meaningful operation in the context of the use case. +3. Create JSON Files: + * For each action, create a request.json file containing the payload to be sent to the system. + * Define the expected output in an expected-response.json file for each action. + * !!! IMPORTANT: The **shellIds, submodeldescriptorIds, idShorts** must be unique. For every POST action create a random/unique UUID and idShort !!! + + + + + + + +