@Override public void setUp() { Blips.init(); }
public static Map<Integer, Element> serialize(Document doc, Wavelet wavelet) { Map<Integer, Element> result = Maps.newHashMap(); ApiView apiView = new ApiView(doc, wavelet); Doc.N node = Blips.getBody(doc); if (node != null) { // The node is the body; we're after its children node = doc.getFirstChild(node); } while (node != null) { E element = doc.asElement(node); if (element != null) { Element apiElement = xmlToApiElement(doc, element, wavelet); if (apiElement != null) { result.put(apiView.transformToTextOffset(doc.getLocation(element)), apiElement); } } node = doc.getNextSibling(node); } return result; }
private void parse(Document doc) { E bodyElement = Blips.getBody(doc); if (bodyElement != null) { N child = doc.getFirstChild(bodyElement); while (child != null) { T asText = doc.asText(child); int xmlPos = doc.getLocation(child); if (asText != null) { bits.add(new Bit(doc.getData(asText), xmlPos)); } else { E xmlElement = doc.asElement(child); if (xmlElement != null) { Element element = ElementSerializer.xmlToApiElement(doc, xmlElement, wavelet); // element can be null, but we still want to note that there // was something unknown. N next = doc.getNextSibling(child); int xmlSize; if (next != null) { xmlSize = doc.getLocation(next) - xmlPos; } else { // At the end of the document. XmlSize is the rest. xmlSize = doc.size() - 1 - xmlPos; } bits.add(new Bit(element, xmlPos, xmlSize)); } } child = doc.getNextSibling(child); } } }
@Override public void setUp() { Blips.init(); }
E firstLineReached = null; outer: for (N node : DocIterate.deep(doc, Blips.getBody(doc), null)) { E el = doc.asElement(node); if (el == null) {
@Override protected void setUp() throws Exception { super.setUp(); Blips.init(); }
@Override protected void setUp() throws Exception { super.setUp(); Blips.init(); }
@Override protected void setUp() throws Exception { super.setUp(); Blips.init(); }
@Override protected void setUp() throws Exception { super.setUp(); Blips.init(); }
@Override protected void setUp() throws Exception { Blips.init(); conversation = makeConversation(); }
@Override protected void setUp() throws Exception { Blips.init(); conversation = makeConversation(); }
@Override protected void setUp() throws Exception { super.setUp(); Blips.init(); conversation = makeConversation(); wavelet = createMockWavelet(conversation); eventMessages = new EventMessageBundle("foo@appspot.com", "http://opensocial.example.com"); }
@Override protected void setUp() throws Exception { super.setUp(); Blips.init(); conversation = makeConversation(); wavelet = createMockWavelet(conversation); eventMessages = new EventMessageBundle("foo@appspot.com", "http://opensocial.example.com"); }
public void testToBlipDataHandlesBlipWithEmptyDocument() throws Exception { Blips.init(); Conversation conversation = makeConversation(); Wavelet wavelet = mock(Wavelet.class); when(wavelet.getWaveId()).thenReturn(WAVE_ID); when(wavelet.getId()).thenReturn(WAVELET_ID); EventDataConverterV21 converter = new EventDataConverterV21(); assertEquals("", converter.toBlipData(conversation.getRootThread().getFirstBlip(), wavelet, new EventMessageBundle(null, null)).getContent()); }
public void testToBlipDataHandlesBlipWithEmptyDocument() throws Exception { Blips.init(); Conversation conversation = makeConversation(); Wavelet wavelet = mock(Wavelet.class); when(wavelet.getWaveId()).thenReturn(WAVE_ID); when(wavelet.getId()).thenReturn(WAVELET_ID); EventDataConverterV21 converter = new EventDataConverterV21(); assertEquals("", converter.toBlipData(conversation.getRootThread().getFirstBlip(), wavelet, new EventMessageBundle(null, null)).getContent()); }
private void setupTest(String content) { Blips.init(); LineRendering.registerContainer(Blips.BODY_TAGNAME, Editor.ROOT_HANDLER_REGISTRY); EditorStaticDeps.setPopupProvider(Popup.LIGHTWEIGHT_POPUP_PROVIDER); editor = (EditorImpl)Editors.create(); editor.init(Editor.ROOT_REGISTRIES, null, EditorSettings.DEFAULT); System.err.println(content); ContentSerialisationUtil.setContentString(editor, content); doc = editor.mutable(); aggressiveSelectionHelper = editor.getAggressiveSelectionHelper(); }
private void setupTest(String content) { Blips.init(); LineRendering.registerContainer(Blips.BODY_TAGNAME, Editor.ROOT_HANDLER_REGISTRY); EditorStaticDeps.setPopupProvider(Popup.LIGHTWEIGHT_POPUP_PROVIDER); editor = (EditorImpl)Editors.create(); editor.init(Editor.ROOT_REGISTRIES, null, EditorSettings.DEFAULT); System.err.println(content); ContentSerialisationUtil.setContentString(editor, content); doc = editor.mutable(); aggressiveSelectionHelper = editor.getAggressiveSelectionHelper(); }