@Test public void testFetchNonExisting() { try { PastryNodeImpl node1 = nodes.get(0); System.out.println("Fetching artifact ..."); node1.fetchEnvelopeAsync("testtesttest", new StorageEnvelopeHandler() { @Override public void onEnvelopeReceived(EnvelopeVersion envelope) { Assert.fail("Unexpected result (" + envelope.toString() + ")!"); } }, new StorageExceptionHandler() { @Override public void onException(Exception e) { if (e instanceof EnvelopeNotFoundException) { System.out.println("Expected exception '" + e.toString() + "' received."); asyncTestState = true; } else { Assert.fail("Unexpected exception (" + e.toString() + ")!"); } } }); System.out.println("Waiting ..."); for (int n = 1; n <= 100; n++) { if (asyncTestState) { return; } Thread.sleep(100); } Assert.fail("Exception expected!"); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.toString()); } }
@Override public String toString() { return identifier + "#" + version; }
EnvelopeVersion implements Serializable, XmlAble { @Override public String toString() { return identifier + "#" + version; } }
EnvelopeVersion implements Serializable, XmlAble { @Override public String toString() { return identifier + "#" + version; } private  EnvelopeVersion(String identifier, long version, PublicKey authorPubKey,
			HashMap<PublicKey, byte[]> readerKeys, HashSet<String> readerGroupIds, byte[] rawContent); protected  EnvelopeVersion(String identifier, PublicKey authorPubKey, Serializable content, Collection<?> readers); protected  EnvelopeVersion(EnvelopeVersion previousVersion, Serializable content); protected  EnvelopeVersion(EnvelopeVersion previousVersion, Serializable content, Collection<?> readers); protected  EnvelopeVersion(String identifier, long version, PublicKey authorPubKey, Serializable content,
			Collection<?> readers, Set<String> readerGroups); }
EnvelopeVersion implements Serializable, XmlAble { @Override public String toString() { return identifier + "#" + version; } private  EnvelopeVersion(String identifier, long version, PublicKey authorPubKey,
			HashMap<PublicKey, byte[]> readerKeys, HashSet<String> readerGroupIds, byte[] rawContent); protected  EnvelopeVersion(String identifier, PublicKey authorPubKey, Serializable content, Collection<?> readers); protected  EnvelopeVersion(EnvelopeVersion previousVersion, Serializable content); protected  EnvelopeVersion(EnvelopeVersion previousVersion, Serializable content, Collection<?> readers); protected  EnvelopeVersion(String identifier, long version, PublicKey authorPubKey, Serializable content,
			Collection<?> readers, Set<String> readerGroups); static String getAgentIdentifier(String agentId); String getIdentifier(); long getVersion(); PublicKey getAuthorPublicKey(); @Override String toString(); boolean isEncrypted(); HashMap<PublicKey, byte[]> getReaderKeys(); Set<String> getReaderGroupIds(); Serializable getContent(); Serializable getContent(AgentContext context); @Override String toXmlString(); static EnvelopeVersion createFromXml(Element rootElement); static EnvelopeVersion createFromXml(String xml); }
EnvelopeVersion implements Serializable, XmlAble { @Override public String toString() { return identifier + "#" + version; } private  EnvelopeVersion(String identifier, long version, PublicKey authorPubKey,
			HashMap<PublicKey, byte[]> readerKeys, HashSet<String> readerGroupIds, byte[] rawContent); protected  EnvelopeVersion(String identifier, PublicKey authorPubKey, Serializable content, Collection<?> readers); protected  EnvelopeVersion(EnvelopeVersion previousVersion, Serializable content); protected  EnvelopeVersion(EnvelopeVersion previousVersion, Serializable content, Collection<?> readers); protected  EnvelopeVersion(String identifier, long version, PublicKey authorPubKey, Serializable content,
			Collection<?> readers, Set<String> readerGroups); static String getAgentIdentifier(String agentId); String getIdentifier(); long getVersion(); PublicKey getAuthorPublicKey(); @Override String toString(); boolean isEncrypted(); HashMap<PublicKey, byte[]> getReaderKeys(); Set<String> getReaderGroupIds(); Serializable getContent(); Serializable getContent(AgentContext context); @Override String toXmlString(); static EnvelopeVersion createFromXml(Element rootElement); static EnvelopeVersion createFromXml(String xml); static final long LATEST_VERSION; static final long NULL_VERSION; static final long START_VERSION; static final long MAX_UPDATE_CYCLES; }