Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAS thumbnail operations #142

Closed
wants to merge 0 commits into from
Closed

Conversation

zhangzai123
Copy link
Contributor

No description provided.

@@ -287,6 +298,80 @@ public void getPaginatedSubmodelReferencesPaginated() {
.get());
}

@Test
public void updateThumbnail() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not testing the updateThumbnail behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I test the setThumbnail behavior. THe shell did not has a thumbnail before, and after setThumbnail, the shell should have a thumbnail. Here I asset that the thumbnail exists.

return executePutRequest(client, putRequest);
}

private CloseableHttpResponse executePutRequest(CloseableHttpClient client, HttpPut putRequest) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this put request, a file must be uploaded. In the method of BaSyxHttpUtils#L140, you cannot upload file, only string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IN BaSyxHttpUtils verlegen

CloseableHttpResponse response = BaSyxHttpTestUtils.executeDeleteOnURL(getThumbnailAccessURL(dummyAasId));
assertEquals(HttpStatus.OK.value(), response.getCode());

response = BaSyxHttpTestUtils.executeGetOnURL(getThumbnailAccessURL(dummyAasId));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate in another test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cannot be seperated since I at first create a thumbnail because the shell had no thumbnail before, then I delete it, after that I use to get thumbnail to validate that the thumbnail is deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clarified

aasRepo.setThumbnail(AAS2, THUMBNAIL_FILE_PATH_1, "", getInputStreamOfFileFromClasspath(THUMBNAIL_FILE_PATH_1));
aasRepo.deleteThumbnail(AAS2);

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you also use @test(expected = FileDoesNotExistException.class) here?

}

@Test
public void deleteNoneExistingThumbnail() throws FileNotFoundException, UnsupportedEncodingException, ClientProtocolException, IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo deleteNon*ExistingThumbnail

}

@Test
public void getFileFromNotExistElement() throws FileNotFoundException, UnsupportedEncodingException, ClientProtocolException, IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getFileFromNonExistingElement

pom.xml Outdated
@@ -16,10 +16,10 @@
<module>basyx.common</module>
<module>basyx.submodelservice</module>
<module>basyx.submodelrepository</module>
<module>basyx.submodelregistry</module>
<!--<module>basyx.submodelregistry</module>-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncomment

pom.xml Outdated
<module>basyx.aasservice</module>
<module>basyx.aasrepository</module>
<module>basyx.aasregistry</module>
<!--<module>basyx.aasregistry</module>-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uncomment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants