Search in sources :

Example 1 with DefaultFileInputSource

use of org.xwiki.filter.input.DefaultFileInputSource in project xwiki-platform by xwiki.

the class XARInputFilterStreamTest method testSkipFirstDocument.

@Test
public void testSkipFirstDocument() throws FilterException, IOException, ComponentLookupException {
    XARInputProperties xarProperties = new XARInputProperties();
    xarProperties.setSource(new DefaultFileInputSource(extensionPackager.getExtensionFile(new ExtensionId("xar1", "1.0"))));
    EntityReferenceSet entities = new EntityReferenceSet();
    entities.includes(new LocalDocumentReference("space2", "page2"));
    xarProperties.setEntities(entities);
    assertXML("testSkipFirstDocument", xarProperties);
    assertTrue(this.allLogRule.getMarker(0).contains(WikiDocumentFilter.LOG_DOCUMENT_SKIPPED));
}
Also used : EntityReferenceSet(org.xwiki.model.reference.EntityReferenceSet) LocalDocumentReference(org.xwiki.model.reference.LocalDocumentReference) XARInputProperties(org.xwiki.filter.xar.input.XARInputProperties) DefaultFileInputSource(org.xwiki.filter.input.DefaultFileInputSource) ExtensionId(org.xwiki.extension.ExtensionId) Test(org.junit.Test)

Example 2 with DefaultFileInputSource

use of org.xwiki.filter.input.DefaultFileInputSource in project xwiki-platform by xwiki.

the class XARInputFilterStreamTest method testSkipLastSpace.

@Test
public void testSkipLastSpace() throws FilterException, IOException, ComponentLookupException {
    XARInputProperties xarProperties = new XARInputProperties();
    xarProperties.setSource(new DefaultFileInputSource(extensionPackager.getExtensionFile(new ExtensionId("xar1", "1.0"))));
    EntityReferenceSet entities = new EntityReferenceSet();
    entities.excludes(new EntityReference("space2", EntityType.SPACE));
    xarProperties.setEntities(entities);
    assertXML("testSkipLastSpace", xarProperties);
    assertTrue(this.allLogRule.getMarker(0).contains(WikiDocumentFilter.LOG_DOCUMENT_SKIPPED));
}
Also used : EntityReferenceSet(org.xwiki.model.reference.EntityReferenceSet) XARInputProperties(org.xwiki.filter.xar.input.XARInputProperties) EntityReference(org.xwiki.model.reference.EntityReference) DefaultFileInputSource(org.xwiki.filter.input.DefaultFileInputSource) ExtensionId(org.xwiki.extension.ExtensionId) Test(org.junit.Test)

Example 3 with DefaultFileInputSource

use of org.xwiki.filter.input.DefaultFileInputSource in project xwiki-platform by xwiki.

the class XWikiFileDeletedDocumentContent method getXWikiDocument.

@Override
public XWikiDocument getXWikiDocument(XWikiDocument document) throws XWikiException, IOException {
    XWikiDocument result = document;
    if (result == null) {
        result = new XWikiDocument();
    }
    result.fromXML(new DefaultFileInputSource(this.content), true);
    return result;
}
Also used : XWikiDocument(com.xpn.xwiki.doc.XWikiDocument) DefaultFileInputSource(org.xwiki.filter.input.DefaultFileInputSource)

Aggregations

DefaultFileInputSource (org.xwiki.filter.input.DefaultFileInputSource)3 Test (org.junit.Test)2 ExtensionId (org.xwiki.extension.ExtensionId)2 XARInputProperties (org.xwiki.filter.xar.input.XARInputProperties)2 EntityReferenceSet (org.xwiki.model.reference.EntityReferenceSet)2 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)1 EntityReference (org.xwiki.model.reference.EntityReference)1 LocalDocumentReference (org.xwiki.model.reference.LocalDocumentReference)1