@Test(expected = GetFailedException.class) public void testGetFailedExceptions() throws NoPeerConnectionException, GetFailedException { String otherUser = randomString(); H2HTestData noPublicKey = new H2HTestData("public key"); Parameters parameters = new Parameters().setLocationKey(otherUser).setContentKey(H2HConstants.USER_PUBLIC_KEY) .setNetworkContent(noPublicKey); Assert.assertEquals(H2HPutStatus.OK, NetworkTestUtil.getRandomNode(network).getDataManager().put(parameters)); publicKeyManager.getPublicKey(otherUser); }
public PublicKey getPublicKey(String userId) throws GetFailedException { logger.debug("Requested to get the public key of user '{}'.", userId); if (this.userId.equals(userId)) { return usersKeyPair.getPublic(); } if (publicKeyCache.containsKey(userId)) { return publicKeyCache.get(userId); } IParameters parameters = new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_PUBLIC_KEY); BaseNetworkContent content = dataManager.get(parameters); return evaluateResult(content, userId); }
PublicKeyManager { public PublicKey getPublicKey(String userId) throws GetFailedException { logger.debug("Requested to get the public key of user '{}'.", userId); if (this.userId.equals(userId)) { return usersKeyPair.getPublic(); } if (publicKeyCache.containsKey(userId)) { return publicKeyCache.get(userId); } IParameters parameters = new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_PUBLIC_KEY); BaseNetworkContent content = dataManager.get(parameters); return evaluateResult(content, userId); } }
PublicKeyManager { public PublicKey getPublicKey(String userId) throws GetFailedException { logger.debug("Requested to get the public key of user '{}'.", userId); if (this.userId.equals(userId)) { return usersKeyPair.getPublic(); } if (publicKeyCache.containsKey(userId)) { return publicKeyCache.get(userId); } IParameters parameters = new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_PUBLIC_KEY); BaseNetworkContent content = dataManager.get(parameters); return evaluateResult(content, userId); } PublicKeyManager(String userId, KeyPair usersKeyPair, KeyPair defaultProtectionKeyPair, DataManager dataManager); }
PublicKeyManager { public PublicKey getPublicKey(String userId) throws GetFailedException { logger.debug("Requested to get the public key of user '{}'.", userId); if (this.userId.equals(userId)) { return usersKeyPair.getPublic(); } if (publicKeyCache.containsKey(userId)) { return publicKeyCache.get(userId); } IParameters parameters = new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_PUBLIC_KEY); BaseNetworkContent content = dataManager.get(parameters); return evaluateResult(content, userId); } PublicKeyManager(String userId, KeyPair usersKeyPair, KeyPair defaultProtectionKeyPair, DataManager dataManager); PublicKey getOwnPublicKey(); PrivateKey getOwnPrivateKey(); KeyPair getOwnKeyPair(); KeyPair getDefaultProtectionKeyPair(); Map<String, PublicKey> getCachedPublicKeys(); void putPublicKey(String userId, PublicKey publicKey); boolean containsPublicKey(String userId); PublicKey getPublicKey(String userId); }
PublicKeyManager { public PublicKey getPublicKey(String userId) throws GetFailedException { logger.debug("Requested to get the public key of user '{}'.", userId); if (this.userId.equals(userId)) { return usersKeyPair.getPublic(); } if (publicKeyCache.containsKey(userId)) { return publicKeyCache.get(userId); } IParameters parameters = new Parameters().setLocationKey(userId).setContentKey(H2HConstants.USER_PUBLIC_KEY); BaseNetworkContent content = dataManager.get(parameters); return evaluateResult(content, userId); } PublicKeyManager(String userId, KeyPair usersKeyPair, KeyPair defaultProtectionKeyPair, DataManager dataManager); PublicKey getOwnPublicKey(); PrivateKey getOwnPrivateKey(); KeyPair getOwnKeyPair(); KeyPair getDefaultProtectionKeyPair(); Map<String, PublicKey> getCachedPublicKeys(); void putPublicKey(String userId, PublicKey publicKey); boolean containsPublicKey(String userId); PublicKey getPublicKey(String userId);  }