Skip to content

Commit 2fa54ff

Browse files
authored
Change deleteSubmodelReferenceByIdAasRepository to return NO_CONTENT (#961)
* Change deleteSubmodelReferenceByIdAasRepository to return NO_CONTENT status * Fix delete response assertion to expect NO_CONTENT status * Fix delete response assertion to expect NO_CONTENT status
1 parent 6770f59 commit 2fa54ff

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

basyx.aasrepository/basyx.aasrepository-feature-authorization/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/feature/authorization/TestAuthorizedAasRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public void removeSubmodelReferenceWithCorrectRoleAndPermission() throws IOExcep
427427
String accessToken = getAccessToken(DummyCredentialStore.BASYX_ASSET_UPDATER_CREDENTIAL);
428428

429429
CloseableHttpResponse retrievalResponse = deleteElementWithAuthorization(getSpecificSubmodelReferenceUrl(SPECIFIC_SHELL_ID_2, "http://i40.customer.com/type/1/1/testSubmodel"), accessToken);
430-
assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode());
430+
assertEquals(HttpStatus.NO_CONTENT.value(), retrievalResponse.getCode());
431431

432432
deleteElementWithAuthorization(getSpecificAasAccessURL(SPECIFIC_SHELL_ID_2), getAccessToken(DummyCredentialStore.ADMIN_CREDENTIAL));
433433
}
@@ -439,7 +439,7 @@ public void removeSubmodelReferenceWithCorrectRoleAndSpecificAasPermission() thr
439439
String accessToken = getAccessToken(DummyCredentialStore.BASYX_ASSET_UPDATER_TWO_CREDENTIAL);
440440

441441
CloseableHttpResponse retrievalResponse = deleteElementWithAuthorization(getSpecificSubmodelReferenceUrl(SPECIFIC_SHELL_ID_2, "http://i40.customer.com/type/1/1/testSubmodel"), accessToken);
442-
assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode());
442+
assertEquals(HttpStatus.NO_CONTENT.value(), retrievalResponse.getCode());
443443

444444
deleteElementWithAuthorization(getSpecificAasAccessURL(SPECIFIC_SHELL_ID_2), getAccessToken(DummyCredentialStore.ADMIN_CREDENTIAL));
445445
}

basyx.aasrepository/basyx.aasrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryApiHTTPController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public ResponseEntity<Void> putAssetAdministrationShellById(
105105
@Override
106106
public ResponseEntity<Void> deleteSubmodelReferenceByIdAasRepository(Base64UrlEncodedIdentifier aasIdentifier, Base64UrlEncodedIdentifier submodelIdentifier) {
107107
aasRepository.removeSubmodelReference(aasIdentifier.getIdentifier(), submodelIdentifier.getIdentifier());
108-
return new ResponseEntity<Void>(HttpStatus.OK);
108+
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
109109
}
110110

111111
@Override

basyx.aasrepository/basyx.aasrepository-http/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/http/AasRepositoryHTTPSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public void removeSubmodelReference() throws FileNotFoundException, IOException,
280280
CloseableHttpResponse deleteResponse = BaSyxHttpTestUtils.executeDeleteOnURL(url);
281281
CloseableHttpResponse getResponse = BaSyxHttpTestUtils.executeGetOnURL(getSpecificAasSubmodelRefAccessURL(dummyAasId));
282282

283-
assertEquals(200, deleteResponse.getCode());
283+
assertEquals(204, deleteResponse.getCode());
284284

285285
String response = BaSyxHttpTestUtils.getResponseAsString(getResponse);
286286
BaSyxHttpTestUtils.assertSameJSONContent(getSMReferenceRemovalJson(), getJSONWithoutCursorInfo(response));

0 commit comments

Comments
 (0)