/** * Test that we can cope with blips being added to the manifest but not to the * wavelet. */ public void testAddingBlipMissingFromWavelet() { manifestDoc.with(new Action() { @Override public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) { N rootThreadNode = doc.getFirstChild(doc.getDocumentElement()); E rootThread = doc.asElement(rootThreadNode); doc.createChildElement(rootThread, "blip", Collections.singletonMap( "id", idGenerator.newBlipId())); } }); assertNull(target.getRootThread().getFirstBlip()); assertEquals(Collections.emptyList(), getBlipList(target.getRootThread())); }
/** * Test that we can cope with blips being added to the manifest but not to the * wavelet. */ public void testAddingBlipMissingFromWavelet() { manifestDoc.with(new Action() { @Override public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) { N rootThreadNode = doc.getFirstChild(doc.getDocumentElement()); E rootThread = doc.asElement(rootThreadNode); doc.createChildElement(rootThread, "blip", Collections.singletonMap( "id", idGenerator.newBlipId())); } }); assertNull(target.getRootThread().getFirstBlip()); assertEquals(Collections.emptyList(), getBlipList(target.getRootThread())); }
/** * Test that iterating a thread whose manifest contains blips not backed by the * wavelet skips those blips. */ public void testMissingBlipIteration() { WaveletBasedConversationThread thread = target.getRootThread(); WaveletBasedConversationBlip first = thread.appendBlip(); manifestDoc.with(new Action() { @Override public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) { N rootThreadNode = doc.getFirstChild(doc.getDocumentElement()); E rootThread = doc.asElement(rootThreadNode); doc.createChildElement(rootThread, "blip", Collections.singletonMap( "id", idGenerator.newBlipId())); } }); WaveletBasedConversationBlip third = thread.appendBlip(); assertEquals(3, CollectionUtils.newArrayList(thread.getManifestThread().getBlips()).size()); assertEquals(Arrays.asList(first, third), getBlipList(thread)); }
/** * Test that iterating a thread whose manifest contains blips not backed by the * wavelet skips those blips. */ public void testMissingBlipIteration() { WaveletBasedConversationThread thread = target.getRootThread(); WaveletBasedConversationBlip first = thread.appendBlip(); manifestDoc.with(new Action() { @Override public <N, E extends N, T extends N> void exec(MutableDocument<N, E, T> doc) { N rootThreadNode = doc.getFirstChild(doc.getDocumentElement()); E rootThread = doc.asElement(rootThreadNode); doc.createChildElement(rootThread, "blip", Collections.singletonMap( "id", idGenerator.newBlipId())); } }); WaveletBasedConversationBlip third = thread.appendBlip(); assertEquals(3, CollectionUtils.newArrayList(thread.getManifestThread().getBlips()).size()); assertEquals(Arrays.asList(first, third), getBlipList(thread)); }
/** * Test that a conversation can be created on a manifest that contains blips * that are not backed by the wavelet. */ public void testBlipMissingFromWavelet() { WaveletBasedConversation empty = target; WaveletBasedConversation nonEmpty = makeConversation(); nonEmpty.getRootThread().appendBlip(); WaveletBasedConversation conversation = WaveletBasedConversation.create(conversationView, empty.getWavelet(), nonEmpty.getManifest(), idGenerator); assertNull(conversation.getRootThread().getFirstBlip()); assertEquals(Collections.emptyList(), getBlipList(conversation.getRootThread())); }
/** * Test that a conversation can be created on a manifest that contains blips * that are not backed by the wavelet. */ public void testBlipMissingFromWavelet() { WaveletBasedConversation empty = target; WaveletBasedConversation nonEmpty = makeConversation(); nonEmpty.getRootThread().appendBlip(); WaveletBasedConversation conversation = WaveletBasedConversation.create(conversationView, empty.getWavelet(), nonEmpty.getManifest(), idGenerator); assertNull(conversation.getRootThread().getFirstBlip()); assertEquals(Collections.emptyList(), getBlipList(conversation.getRootThread())); }