From b2dbd37c7c61131177118adeb759b7e6fd939805 Mon Sep 17 00:00:00 2001 From: ShehriyarShariq-Fraunhofer Date: Wed, 19 Jun 2024 09:23:32 +0200 Subject: [PATCH] fix: add getAasServiceWithThumnail in new Client tests --- .../client/TestAuthorizedConnectedAasRepository.java | 12 ++++++++++++ .../client/TestAuthorizedConnectedAasService.java | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/basyx.aasrepository/basyx.aasrepository-client/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/client/TestAuthorizedConnectedAasRepository.java b/basyx.aasrepository/basyx.aasrepository-client/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/client/TestAuthorizedConnectedAasRepository.java index aa6903e89..de85e50fa 100644 --- a/basyx.aasrepository/basyx.aasrepository-client/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/client/TestAuthorizedConnectedAasRepository.java +++ b/basyx.aasrepository/basyx.aasrepository-client/src/test/java/org/eclipse/digitaltwin/basyx/aasrepository/client/TestAuthorizedConnectedAasRepository.java @@ -34,6 +34,8 @@ import org.eclipse.digitaltwin.basyx.aasrepository.AasRepositorySuite; import org.eclipse.digitaltwin.basyx.aasrepository.DummyAasFactory; import org.eclipse.digitaltwin.basyx.aasrepository.feature.authorization.DummyAuthorizedAasRepositoryComponent; +import org.eclipse.digitaltwin.basyx.aasservice.AasService; +import org.eclipse.digitaltwin.basyx.aasservice.DummyAssetAdministrationShellFactory; import org.eclipse.digitaltwin.basyx.aasservice.client.TestAuthorizedConnectedAasService; import org.eclipse.digitaltwin.basyx.client.internal.ApiException; import org.eclipse.digitaltwin.basyx.client.internal.authorization.TokenManager; @@ -104,4 +106,14 @@ public void sendUnauthorizedRequest() throws IOException { protected AasRepository getAasRepository() { return new AuthorizedConnectedAasRepository("http://localhost:8081", new TokenManager("http://localhost:9096/realms/BaSyx/protocol/openid-connect/token", new ClientCredentialAccessTokenProvider(new ClientCredential("workstation-1", "nY0mjyECF60DGzNmQUjL81XurSl8etom")))); } + + @Override + protected AasService getAasServiceWithThumbnail() throws IOException { + AssetAdministrationShell expected = DummyAssetAdministrationShellFactory.createForThumbnail(); + AasService aasServiceWithThumbnail = getAasService(expected); + + aasServiceWithThumbnail.setThumbnail("dummyImgA.jpeg", "", createDummyImageIS_A()); + + return aasServiceWithThumbnail; + } } diff --git a/basyx.aasservice/basyx.aasservice-client/src/test/java/org/eclipse/digitaltwin/basyx/aasservice/client/TestAuthorizedConnectedAasService.java b/basyx.aasservice/basyx.aasservice-client/src/test/java/org/eclipse/digitaltwin/basyx/aasservice/client/TestAuthorizedConnectedAasService.java index 57a4d6180..f7d876b43 100644 --- a/basyx.aasservice/basyx.aasservice-client/src/test/java/org/eclipse/digitaltwin/basyx/aasservice/client/TestAuthorizedConnectedAasService.java +++ b/basyx.aasservice/basyx.aasservice-client/src/test/java/org/eclipse/digitaltwin/basyx/aasservice/client/TestAuthorizedConnectedAasService.java @@ -38,6 +38,7 @@ import org.eclipse.digitaltwin.basyx.aasrepository.feature.authorization.DummyAuthorizedAasRepositoryComponent; import org.eclipse.digitaltwin.basyx.aasservice.AasService; import org.eclipse.digitaltwin.basyx.aasservice.AasServiceSuite; +import org.eclipse.digitaltwin.basyx.aasservice.DummyAssetAdministrationShellFactory; import org.eclipse.digitaltwin.basyx.authorization.AccessTokenProvider; import org.eclipse.digitaltwin.basyx.authorization.DummyCredential; import org.eclipse.digitaltwin.basyx.authorization.DummyCredentialStore; @@ -129,6 +130,16 @@ protected AasService getAasService(AssetAdministrationShell shell) { String base64UrlEncodedId = Base64UrlEncodedIdentifier.encodeIdentifier(shell.getId()); return new AuthorizedConnectedAasService(AAS_REPO_URL + base64UrlEncodedId, new TokenManager("http://localhost:9096/realms/BaSyx/protocol/openid-connect/token", new ClientCredentialAccessTokenProvider(new ClientCredential("workstation-1", "nY0mjyECF60DGzNmQUjL81XurSl8etom")))); } + + @Override + protected AasService getAasServiceWithThumbnail() throws IOException { + AssetAdministrationShell expected = DummyAssetAdministrationShellFactory.createForThumbnail(); + AasService aasServiceWithThumbnail = getAasService(expected); + + aasServiceWithThumbnail.setThumbnail("dummyImgA.jpeg", "", createDummyImageIS_A()); + + return aasServiceWithThumbnail; + } public static void configureSecurityContext(AccessTokenProvider accessTokenProvider) throws FileNotFoundException, IOException { String adminToken = getAdminAccessToken(accessTokenProvider);