From 99b7023aba5c09f069badc35d05ea3ef53f3a6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Tue, 14 Jan 2020 20:30:22 +0100 Subject: Add query uninstall calls --- .../agent/QuerySignerApiImplementationTest.java | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java index 70aad63..29d53d2 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/QuerySignerApiImplementationTest.java @@ -18,7 +18,7 @@ import java.security.PublicKey; public class QuerySignerApiImplementationTest { @Test - public void testQueryVerification() { + public void testQueryInstallVerification() { QuerySignerApiImplementation queryApi; try { @@ -29,21 +29,24 @@ public class QuerySignerApiImplementationTest { queryApi = new QuerySignerApiImplementation(publicKey, privateKey); QueryData signedQuery = queryApi.signInstallQuery("&a", "SELECT 1 AS ONE"); QuerySignerApiImplementation.validateInstallQuery("&a", signedQuery, publicKey); - } catch (IOException e) { - e.printStackTrace(); - } catch (NoSuchPaddingException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (InvalidKeyException e) { - e.printStackTrace(); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } catch (QuerySigner.InvalidQueryException e) { + } catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | QuerySigner.InvalidQueryException e) { e.printStackTrace(); } + } + @Test + public void testQueryUninstallVerification() { + QuerySignerApiImplementation queryApi; + try { + String publicKeyFile = "build/tmp/query_signer.pub"; + String privateKeyFile = "build/tmp/query_signer"; + PublicKey publicKey = KeyUtils.getPublicKey(publicKeyFile); + PrivateKey privateKey = KeyUtils.getPrivateKey(privateKeyFile); + queryApi = new QuerySignerApiImplementation(publicKey, privateKey); + QueryData signedQuery = queryApi.signUninstallQuery("&a"); + QuerySignerApiImplementation.validateUninstallQuery("&a", signedQuery, publicKey); + } catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | QuerySigner.InvalidQueryException e) { + e.printStackTrace(); + } } } -- cgit v1.2.3