/** * Returns the position of the body element of the given blip. */ public static int getBodyPosition(ConversationBlip blip) { return getBodyPosition(blip.getContent()); }
public void appendBlipWithText(String text) { ConversationBlip blip = conversation.getRootThread().appendBlip(); LineContainers.appendToLastLine(blip.getContent(), XmlStringBuilder.createText(text)); TitleHelper.maybeFindAndSetImplicitTitle(blip.getContent()); }
public void appendBlipWithText(String text) { ConversationBlip blip = conversation.getRootThread().appendBlip(); LineContainers.appendToLastLine(blip.getContent(), XmlStringBuilder.createText(text)); TitleHelper.maybeFindAndSetImplicitTitle(blip.getContent()); }
void populate(ConversationThread thread, FakeThreadView threadUi) { for (BlipBuilder blipBuilder : blipBuilders) { ConversationBlip blip = thread.appendBlip(); blip.getContent().insertText(blip.getContent().size() - 1, "Blip " + blipCount++); blipBuilder.populate(blip, threadUi.insertBlipBefore(null, blip)); } }
void populate(ConversationThread thread, FakeThreadView threadUi) { for (BlipBuilder blipBuilder : blipBuilders) { ConversationBlip blip = thread.appendBlip(); blip.getContent().insertText(blip.getContent().size() - 1, "Blip " + blipCount++); blipBuilder.populate(blip, threadUi.insertBlipBefore(null, blip)); } }
public void testDeleteInlineReplyDeletesAnchor() { ConversationBlip blip = target.getRootThread().appendBlip(); XmlStringBuilder xmlBefore = XmlStringBuilder.innerXml(blip.getContent()); ConversationThread inlineReply = blip.addReplyThread(locateAfterLineElement( blip.getContent())); ConversationBlip inlineReplyBlip = inlineReply.appendBlip(); inlineReplyBlip.delete(); assertBlipInvalid(inlineReplyBlip); assertThreadInvalid(inlineReply); assertStructureEquivalent(xmlBefore, blip.getContent()); }
public void testDeleteInlineReplyDeletesAnchor() { ConversationBlip blip = target.getRootThread().appendBlip(); XmlStringBuilder xmlBefore = XmlStringBuilder.innerXml(blip.getContent()); ConversationThread inlineReply = blip.addReplyThread(locateAfterLineElement( blip.getContent())); ConversationBlip inlineReplyBlip = inlineReply.appendBlip(); inlineReplyBlip.delete(); assertBlipInvalid(inlineReplyBlip); assertThreadInvalid(inlineReply); assertStructureEquivalent(xmlBefore, blip.getContent()); }
@Override public void execute( OperationRequest operation, OperationContext context, ParticipantId participant) throws InvalidRequestException { String title = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVELET_TITLE); ObservableConversation conversation = context.openConversation(operation, participant).getRoot(); String blipId = conversation.getRootThread().getFirstBlip().getId(); Document doc = context.getBlip(conversation, blipId).getContent(); TitleHelper.setExplicitTitle(doc, title); }
private static void write(ConversationBlip blip, String msg) { org.waveprotocol.wave.model.document.Document d = blip.getContent(); d.emptyElement(d.getDocumentElement()); d.appendXml(XmlStringBuilder.createFromXmlString("<body><line></line>" + msg + "</body>")); }
private static void write(ConversationBlip blip, String msg) { org.waveprotocol.wave.model.document.Document d = blip.getContent(); d.emptyElement(d.getDocumentElement()); d.appendXml(XmlStringBuilder.createFromXmlString("<body><line></line>" + msg + "</body>")); }
private static void sampleReply(ConversationBlip blip) { sampleContent(blip.getContent()); ConversationThread thread = blip.addReplyThread(5); thread.appendBlip(); thread.appendBlip(); }
public void testGenerateDocumentChangedEventOnlyOnce() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); // Change the document twice XmlStringBuilder builder = XmlStringBuilder.createText("some random content"); LineContainers.appendToLastLine(rootBlip.getContent(), builder); LineContainers.appendToLastLine(rootBlip.getContent(), builder); EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); }
public void testGenerateDocumentChangedEventOnlyOnce() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); // Change the document twice XmlStringBuilder builder = XmlStringBuilder.createText("some random content"); LineContainers.appendToLastLine(rootBlip.getContent(), builder); LineContainers.appendToLastLine(rootBlip.getContent(), builder); EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); }
public void testAppendInlineReplyCreatesInlineThread() { ConversationBlip blip = target.getRootThread().appendBlip(); MutableDocument<?, ?, ?> doc = blip.getContent(); int location = locateAfterLineElement(doc); ConversationThread thread = blip.addReplyThread(location); assertSame(blip, thread.getParentBlip()); assertEquals(Collections.singletonList(LocatedReplyThread.of(thread, location)), blip.locateReplyThreads()); assertThreadChildrenConsistent(blip); }
public void testGenerateAnnotatedTextChangedEvent() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); String annotationKey = "key"; String annotationValue = "value"; rootBlip.getContent().setAnnotation(0, 1, annotationKey, annotationValue); EventMessageBundle messages = generateAndCheckEvents(EventType.ANNOTATED_TEXT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); AnnotatedTextChangedEvent event = AnnotatedTextChangedEvent.as(messages.getEvents().get(0)); assertEquals("Expected the key of the annotation", annotationKey, event.getName()); assertEquals("Expected the value of the annotation", annotationValue, event.getValue()); }
public void testAppendInlineReplyCreatesInlineThread() { ConversationBlip blip = target.getRootThread().appendBlip(); MutableDocument<?, ?, ?> doc = blip.getContent(); int location = locateAfterLineElement(doc); ConversationThread thread = blip.addReplyThread(location); assertSame(blip, thread.getParentBlip()); assertEquals(Collections.singletonList(LocatedReplyThread.of(thread, location)), blip.locateReplyThreads()); assertThreadChildrenConsistent(blip); }
public void testGenerateAnnotatedTextChangedEvent() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); String annotationKey = "key"; String annotationValue = "value"; rootBlip.getContent().setAnnotation(0, 1, annotationKey, annotationValue); EventMessageBundle messages = generateAndCheckEvents(EventType.ANNOTATED_TEXT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); AnnotatedTextChangedEvent event = AnnotatedTextChangedEvent.as(messages.getEvents().get(0)); assertEquals("Expected the key of the annotation", annotationKey, event.getName()); assertEquals("Expected the value of the annotation", annotationValue, event.getValue()); }
public void testGenerateDocumentChangedEvent() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); XmlStringBuilder builder = XmlStringBuilder.createText("some random content"); LineContainers.appendToLastLine(rootBlip.getContent(), builder); EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED); assertEquals("Expected one event", 1, messages.getEvents().size()); // Can not check the blip id because it is not accessible, however the line // here below will confirm that there was actually a real // DocumentChangedEvent put into the message bundle. DocumentChangedEvent event = DocumentChangedEvent.as(messages.getEvents().get(0)); assertEquals(ALEX.getAddress(), event.getModifiedBy()); }
public void testDeleteBlipWithInlineReplyDeletesReply() { ConversationBlip blip = target.getRootThread().appendBlip(); MutableDocument<?, ?, ?> doc = blip.getContent(); ConversationThread reply = blip.addReplyThread(locateAfterLineElement(doc)); ConversationBlip replyBlip = reply.appendBlip(); blip.delete(); assertNull(target.getRootThread().getFirstBlip()); assertThreadInvalid(reply); assertBlipInvalid(replyBlip); }
public void testDeleteBlipWithInlineReplyDeletesReply() { ConversationBlip blip = target.getRootThread().appendBlip(); MutableDocument<?, ?, ?> doc = blip.getContent(); ConversationThread reply = blip.addReplyThread(locateAfterLineElement(doc)); ConversationBlip replyBlip = reply.appendBlip(); blip.delete(); assertNull(target.getRootThread().getFirstBlip()); assertThreadInvalid(reply); assertBlipInvalid(replyBlip); }