Skip to content

Commit

Permalink
fix: refactor utility url functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ShehriyarShariq-Fraunhofer committed Sep 2, 2024
1 parent b4afd85 commit bcdef6e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public void getSubmodelElementValueWithCorrectRoleAndPermission() throws IOExcep
DummyCredential dummyCredential = DummyCredentialStore.BASYX_READER_CREDENTIAL;

String accessToken = tokenProvider.getAccessToken(dummyCredential.getUsername(), dummyCredential.getPassword());

CloseableHttpResponse retrievalResponse = getElementWithAuthorization(getSpecificSubmodelElementValueAccessURL(SPECIFIC_SUBMODEL_ID, SUBMODEL_ELEMENT_IDSHORT_PATH), accessToken);
assertEquals(HttpStatus.OK.value(), retrievalResponse.getCode());
}
Expand Down Expand Up @@ -1218,7 +1218,7 @@ private CloseableHttpResponse getElementWithNoAuthorization(String url) throws I
}

private String getSpecificSubmodelAccessURL(String submodelId) {
return RepositoryUrlHelper.createRepositoryUrl(RepositoryUrlHelper.createRepositoryUrl(submodelRepositoryBaseUrl, SUBMODEL_REPOSITORY_PATH), SUBMODEL_REPOSITORY_PATH) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(submodelId);
return RepositoryUrlHelper.createRepositoryUrl(submodelRepositoryBaseUrl, SUBMODEL_REPOSITORY_PATH) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(submodelId);
}

private String getSpecificSubmodelValueOnlyAccessURL(String submodelId) {
Expand All @@ -1230,7 +1230,7 @@ private String getSpecificSubmodelMetadataAccessURL(String submodelId) {
}

private String getSpecificSubmodelElementAccessURL(String submodelId, String submodelElementIdShortPath) {
return RepositoryUrlHelper.createRepositoryUrl(RepositoryUrlHelper.createRepositoryUrl(submodelRepositoryBaseUrl, SUBMODEL_REPOSITORY_PATH), SUBMODEL_REPOSITORY_PATH) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(submodelId) + "/submodel-elements/" + submodelElementIdShortPath;
return RepositoryUrlHelper.createRepositoryUrl(submodelRepositoryBaseUrl, SUBMODEL_REPOSITORY_PATH) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(submodelId) + "/submodel-elements/" + submodelElementIdShortPath;
}

private String getSpecificSubmodelElementValueAccessURL(String submodelId, String submodelElementIdShortPath) {
Expand Down Expand Up @@ -1258,7 +1258,7 @@ private CloseableHttpResponse requestOperationInvocationNoAuthorization(String u
}

protected String getAllSubmodelElementsAccessURL(String submodelId) {
return RepositoryUrlHelper.createRepositoryUrl(RepositoryUrlHelper.createRepositoryUrl(submodelRepositoryBaseUrl, SUBMODEL_REPOSITORY_PATH), SUBMODEL_REPOSITORY_PATH) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(submodelId) + "/submodel-elements";
return RepositoryUrlHelper.createRepositoryUrl(submodelRepositoryBaseUrl, SUBMODEL_REPOSITORY_PATH) + "/" + Base64UrlEncodedIdentifier.encodeIdentifier(submodelId) + "/submodel-elements";
}

private static CloseableHttpResponse createElementOnRepositoryWithAuthorization(String url, String submodelJsonContent, String accessToken) throws IOException {
Expand Down

0 comments on commit bcdef6e

Please sign in to comment.