feat: add tests for submodel methods#360
feat: add tests for submodel methods#360aaronzi merged 31 commits intoeclipse-basyx:mainfrom ShehriyarShariq-Fraunhofer:add-test-cases-for-submodel-methods
Conversation
…a + patchSubmodelElements
…com/ShehriyarShariq-Fraunhofer/basyx-java-server-sdk into add-test-cases-for-submodel-methods
mateusmolina-iese
left a comment
There was a problem hiding this comment.
Please check if https://github.com/ShehriyarShariq-Fraunhofer/basyx-java-server-sdk/blob/cef93d3d458ab88a2fea898bea48e020db5c7d0d/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryApiHTTPController.java#L204 is being tested
| submodelService.deleteFileValue(SubmodelServiceHelper.SUBMODEL_TECHNICAL_DATA_FILE_ID_SHORT); | ||
| } | ||
|
|
||
| return repoApi.getSubmodelById(submodelId, null, null); | ||
| } catch (ApiException e) { | ||
| if (e.getCode() == HttpStatus.NOT_FOUND.value()) { | ||
| throw new ElementDoesNotExistException(submodelId); |
There was a problem hiding this comment.
Use mapExceptionSubmodelAccess(...) instead of the conditional
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { |
There was a problem hiding this comment.
do we need to override equals here?
There was a problem hiding this comment.
In getSubmodelByIdValueOnlyExistingSubmodel, I need to compare the objects of type SubmodelValueOnly which have a Map of items where the value is of type SubmodelElementValue.
PropertyValue implements the interface SubmodelElementValue, hence, when i compare the SubmodelValueOnly objects, I'm actually comparing their map of items to check if they are equal.
Given that PropertyValue isn't a primitive data type, I had to add the equals method so that the comparison can be made between the items. The test fails otherwise.
|
Yes, it is being tested. SubmodelRepositoryApiHTTPController uses SubmodelRepository and basyx.submodelrepository-core contains the test for getSubmodelByIdValueOnly in SubmodelRepositorySuite.java. |
…com/ShehriyarShariq-Fraunhofer/basyx-java-server-sdk into add-test-cases-for-submodel-methods
| public Submodel getSubmodelByIdMetadata(String submodelId) throws ElementDoesNotExistException { | ||
| return repoApi.getSubmodelById(submodelId, null, null); | ||
| try { | ||
| return repoApi.getSubmodelById(submodelId, null, null); |
There was a problem hiding this comment.
should be getSubmodelByIdMetadata
Pull Request Template
Description of Changes
Added test cases for SubmodelRepository(getSubmodelByIdValueOnly and getSubmodelByIdMetadata) and SubmodelService(patchSubmodelElements).