Skip to content

Commit

Permalink
Change status code for thumbnail upload to 204 (no_content) (#426)
Browse files Browse the repository at this point in the history
* Change status code for thumbnail upload to 204 (no_content).

refs #359

* Trigger build

* Update authorization tests and alter the status code

refs #359
  • Loading branch information
geso02 authored Sep 11, 2024
1 parent 51e84c6 commit 7b01e4c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public void setThumbnailWithCorrectRoleAndPermission() throws IOException {
String accessToken = getAccessToken(DummyCredentialStore.BASYX_UPDATER_CREDENTIAL);

CloseableHttpResponse retrievalResponse = setThumbnailToAasWithAuthorization(SPECIFIC_SHELL_ID, accessToken);
assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode());
assertEquals(HttpStatus.NO_CONTENT.value(), retrievalResponse.getCode());

deleteElementWithAuthorization(BaSyxHttpTestUtils.getThumbnailAccessURL(createAasRepositoryUrl(aasRepositoryBaseUrl), SPECIFIC_SHELL_ID), getAccessToken(DummyCredentialStore.ADMIN_CREDENTIAL));
}
Expand All @@ -585,7 +585,7 @@ public void setThumbnailWithCorrectRoleAndSpecificAasPermission() throws IOExcep
String accessToken = getAccessToken(DummyCredentialStore.BASYX_UPDATER_TWO_CREDENTIAL);

CloseableHttpResponse retrievalResponse = setThumbnailToAasWithAuthorization(SPECIFIC_SHELL_ID, accessToken);
assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode());
assertEquals(HttpStatus.NO_CONTENT.value(), retrievalResponse.getCode());

deleteElementWithAuthorization(BaSyxHttpTestUtils.getThumbnailAccessURL(createAasRepositoryUrl(aasRepositoryBaseUrl), SPECIFIC_SHELL_ID), getAccessToken(DummyCredentialStore.ADMIN_CREDENTIAL));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public ResponseEntity<Void> putThumbnailAasRepository(Base64UrlEncodedIdentifier
fileInputstream = file.getInputStream();
aasRepository.setThumbnail(aasIdentifier.getIdentifier(), fileName, file.getContentType(), fileInputstream);
closeInputStream(fileInputstream);
return new ResponseEntity<Void>(HttpStatus.OK);
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
} catch (IOException e) {
closeInputStream(fileInputstream);
return new ResponseEntity<Void>(HttpStatus.INTERNAL_SERVER_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public void uploadThumbnailToShell() throws IOException {
createDummyAasOnServer(getAas1JSONString());
CloseableHttpResponse getThumbnailResponse = uploadThumbnail(dummyAasId);

assertEquals(HttpStatus.OK.value(), getThumbnailResponse.getCode());
assertEquals(HttpStatus.NO_CONTENT.value(), getThumbnailResponse.getCode());

getThumbnailResponse.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* {@link AasRepository} HTTP/REST API
*
* @author schnicke, danish
*
*
*/
public class TestAasRepositoryHTTP extends AasRepositoryHTTPSuite {
private static final PaginationInfo NO_LIMIT_PAGINATION_INFO = new PaginationInfo(0, null);
Expand Down

0 comments on commit 7b01e4c

Please sign in to comment.