Skip to content

Commit 7b01e4c

Browse files
authored
Change status code for thumbnail upload to 204 (no_content) (#426)
* Change status code for thumbnail upload to 204 (no_content). refs #359 * Trigger build * Update authorization tests and alter the status code refs #359
1 parent 51e84c6 commit 7b01e4c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

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
@@ -575,7 +575,7 @@ public void setThumbnailWithCorrectRoleAndPermission() throws IOException {
575575
String accessToken = getAccessToken(DummyCredentialStore.BASYX_UPDATER_CREDENTIAL);
576576

577577
CloseableHttpResponse retrievalResponse = setThumbnailToAasWithAuthorization(SPECIFIC_SHELL_ID, accessToken);
578-
assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode());
578+
assertEquals(HttpStatus.NO_CONTENT.value(), retrievalResponse.getCode());
579579

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

587587
CloseableHttpResponse retrievalResponse = setThumbnailToAasWithAuthorization(SPECIFIC_SHELL_ID, accessToken);
588-
assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode());
588+
assertEquals(HttpStatus.NO_CONTENT.value(), retrievalResponse.getCode());
589589

590590
deleteElementWithAuthorization(BaSyxHttpTestUtils.getThumbnailAccessURL(createAasRepositoryUrl(aasRepositoryBaseUrl), SPECIFIC_SHELL_ID), getAccessToken(DummyCredentialStore.ADMIN_CREDENTIAL));
591591
}

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
@@ -204,7 +204,7 @@ public ResponseEntity<Void> putThumbnailAasRepository(Base64UrlEncodedIdentifier
204204
fileInputstream = file.getInputStream();
205205
aasRepository.setThumbnail(aasIdentifier.getIdentifier(), fileName, file.getContentType(), fileInputstream);
206206
closeInputStream(fileInputstream);
207-
return new ResponseEntity<Void>(HttpStatus.OK);
207+
return new ResponseEntity<Void>(HttpStatus.NO_CONTENT);
208208
} catch (IOException e) {
209209
closeInputStream(fileInputstream);
210210
return new ResponseEntity<Void>(HttpStatus.INTERNAL_SERVER_ERROR);

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
@@ -336,7 +336,7 @@ public void uploadThumbnailToShell() throws IOException {
336336
createDummyAasOnServer(getAas1JSONString());
337337
CloseableHttpResponse getThumbnailResponse = uploadThumbnail(dummyAasId);
338338

339-
assertEquals(HttpStatus.OK.value(), getThumbnailResponse.getCode());
339+
assertEquals(HttpStatus.NO_CONTENT.value(), getThumbnailResponse.getCode());
340340

341341
getThumbnailResponse.close();
342342
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* {@link AasRepository} HTTP/REST API
3939
*
4040
* @author schnicke, danish
41-
*
41+
*
4242
*/
4343
public class TestAasRepositoryHTTP extends AasRepositoryHTTPSuite {
4444
private static final PaginationInfo NO_LIMIT_PAGINATION_INFO = new PaginationInfo(0, null);

0 commit comments

Comments
 (0)