@Test public void saveWithAppend() throws Exception { XDOMOfficeDocument doc = mock(XDOMOfficeDocument.class); DocumentReference documentReference = new DocumentReference("wiki", "Space", "Page"); String syntaxId = "test/1.0"; when(documentAccessBridge.isDocumentEditable(documentReference)).thenReturn(true); when(documentAccessBridge.exists(documentReference)).thenReturn(true); DocumentModelBridge document = mock(DocumentModelBridge.class); when(documentAccessBridge.getTranslatedDocumentInstance(documentReference)).thenReturn(document); when(document.getSyntax()).thenReturn(new Syntax(new SyntaxType("test", "Test"), "1.0")); when(documentAccessBridge.getDocumentContent(documentReference, null)).thenReturn("before"); when(doc.getContentAsString(syntaxId)).thenReturn("after"); assertTrue(officeImporterScriptService.save(doc, documentReference, syntaxId, null, null, true)); verify(documentAccessBridge).setDocumentContent(documentReference, "before\nafter", "Updated by office importer.", false); }
@Unstable public boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, DocumentReference parentReference, String title, boolean append) { return save(doc, documentReference, this.extendedRenderingConfiguration.getDefaultContentSyntax().toIdString(), parentReference, title, append); }
OfficeImporterScriptService implements ScriptService { @Unstable public boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, DocumentReference parentReference, String title, boolean append) { return save(doc, documentReference, this.extendedRenderingConfiguration.getDefaultContentSyntax().toIdString(), parentReference, title, append); } }
OfficeImporterScriptService implements ScriptService { @Unstable public boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, DocumentReference parentReference, String title, boolean append) { return save(doc, documentReference, this.extendedRenderingConfiguration.getDefaultContentSyntax().toIdString(), parentReference, title, append); }  }
OfficeImporterScriptService implements ScriptService { @Unstable public boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, DocumentReference parentReference, String title, boolean append) { return save(doc, documentReference, this.extendedRenderingConfiguration.getDefaultContentSyntax().toIdString(), parentReference, title, append); }  XHTMLOfficeDocument officeToXHTML(InputStream officeFileStream, String officeFileName,
        DocumentReference targetDocumentReference, boolean filterStyles); XHTMLOfficeDocument officeToXHTML(InputStream officeFileStream, String officeFileName,
        String referenceDocument, boolean filterStyles); XDOMOfficeDocument xhtmlToXDOM(XHTMLOfficeDocument xhtmlOfficeDocument); XDOMOfficeDocument officeToXDOM(InputStream officeFileStream, String officeFileName,
        DocumentReference targetDocumentReference, boolean filterStyles); XDOMOfficeDocument officeToXDOM(InputStream officeFileStream, String officeFileName,
        String referenceDocument, boolean filterStyles); Map<TargetDocumentDescriptor, XDOMOfficeDocument> split(XDOMOfficeDocument xdomDocument,
        String[] headingLevels, String namingCriterionHint, DocumentReference rootDocumentReference); Map<TargetDocumentDescriptor, XDOMOfficeDocument> split(XDOMOfficeDocument xdomDocument,
        String[] headingLevels, String namingCriterionHint, String rootDocumentName); @Unstable boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, DocumentReference parentReference,
        String title, boolean append); boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, String syntaxId,
        DocumentReference parentReference, String title, boolean append); boolean save(XDOMOfficeDocument doc, String target, String syntaxId, String parent, String title,
        boolean append); String getErrorMessage(); }
OfficeImporterScriptService implements ScriptService { @Unstable public boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, DocumentReference parentReference, String title, boolean append) { return save(doc, documentReference, this.extendedRenderingConfiguration.getDefaultContentSyntax().toIdString(), parentReference, title, append); }  XHTMLOfficeDocument officeToXHTML(InputStream officeFileStream, String officeFileName,
        DocumentReference targetDocumentReference, boolean filterStyles); XHTMLOfficeDocument officeToXHTML(InputStream officeFileStream, String officeFileName,
        String referenceDocument, boolean filterStyles); XDOMOfficeDocument xhtmlToXDOM(XHTMLOfficeDocument xhtmlOfficeDocument); XDOMOfficeDocument officeToXDOM(InputStream officeFileStream, String officeFileName,
        DocumentReference targetDocumentReference, boolean filterStyles); XDOMOfficeDocument officeToXDOM(InputStream officeFileStream, String officeFileName,
        String referenceDocument, boolean filterStyles); Map<TargetDocumentDescriptor, XDOMOfficeDocument> split(XDOMOfficeDocument xdomDocument,
        String[] headingLevels, String namingCriterionHint, DocumentReference rootDocumentReference); Map<TargetDocumentDescriptor, XDOMOfficeDocument> split(XDOMOfficeDocument xdomDocument,
        String[] headingLevels, String namingCriterionHint, String rootDocumentName); @Unstable boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, DocumentReference parentReference,
        String title, boolean append); boolean save(XDOMOfficeDocument doc, DocumentReference documentReference, String syntaxId,
        DocumentReference parentReference, String title, boolean append); boolean save(XDOMOfficeDocument doc, String target, String syntaxId, String parent, String title,
        boolean append); String getErrorMessage(); static final String OFFICE_IMPORTER_ERROR; }