Search in sources :

Example 6 with MacroId

use of org.xwiki.rendering.macro.MacroId in project xwiki-platform by xwiki.

the class DefaultWikiMacroTest method registerWikiMacro.

private void registerWikiMacro(String macroId, String macroContent, List<WikiMacroParameterDescriptor> parameterDescriptors) throws Exception {
    WikiMacroDescriptor descriptor = new WikiMacroDescriptor(new MacroId(macroId), "Wiki Macro", "Description", "Test", WikiMacroVisibility.GLOBAL, new DefaultContentDescriptor(false), parameterDescriptors);
    DefaultWikiMacro wikiMacro = new DefaultWikiMacro(wikiMacroDocumentReference, this.user.getDocumentReference(), true, descriptor, this.xwiki20Parser.parse(new StringReader(macroContent)), Syntax.XWIKI_2_0, getComponentManager());
    this.wikiMacroManager.registerWikiMacro(wikiMacroDocumentReference, wikiMacro);
}
Also used : DefaultContentDescriptor(org.xwiki.rendering.macro.descriptor.DefaultContentDescriptor) StringReader(java.io.StringReader) MacroId(org.xwiki.rendering.macro.MacroId) WikiMacroDescriptor(org.xwiki.rendering.macro.wikibridge.WikiMacroDescriptor) DefaultWikiMacro(org.xwiki.rendering.internal.macro.wikibridge.DefaultWikiMacro)

Example 7 with MacroId

use of org.xwiki.rendering.macro.MacroId in project xwiki-platform by xwiki.

the class DefaultWikiMacroManagerTest method generateWikiMacro.

private DefaultWikiMacro generateWikiMacro(WikiMacroVisibility visibility) throws Exception {
    DocumentReference wikiMacroDocReference = new DocumentReference("wiki", Arrays.asList("space"), "space");
    WikiMacroDescriptor descriptor = new WikiMacroDescriptor(new MacroId("testwikimacro"), "Test Wiki Macro", "Description", "Test", visibility, new DefaultContentDescriptor(), Collections.<WikiMacroParameterDescriptor>emptyList());
    XDOM xdom = new XDOM(Arrays.asList(new ParagraphBlock(Arrays.<Block>asList(new WordBlock("test")))));
    DefaultWikiMacro wikiMacro = new DefaultWikiMacro(wikiMacroDocReference, authorReference, true, descriptor, xdom, Syntax.XWIKI_2_0, this.mocker);
    return wikiMacro;
}
Also used : DefaultContentDescriptor(org.xwiki.rendering.macro.descriptor.DefaultContentDescriptor) XDOM(org.xwiki.rendering.block.XDOM) WordBlock(org.xwiki.rendering.block.WordBlock) MacroId(org.xwiki.rendering.macro.MacroId) ParagraphBlock(org.xwiki.rendering.block.ParagraphBlock) WikiMacroDescriptor(org.xwiki.rendering.macro.wikibridge.WikiMacroDescriptor) DocumentReference(org.xwiki.model.reference.DocumentReference)

Aggregations

MacroId (org.xwiki.rendering.macro.MacroId)7 DefaultContentDescriptor (org.xwiki.rendering.macro.descriptor.DefaultContentDescriptor)4 WikiMacroDescriptor (org.xwiki.rendering.macro.wikibridge.WikiMacroDescriptor)4 StringReader (java.io.StringReader)2 DocumentReference (org.xwiki.model.reference.DocumentReference)2 XDOM (org.xwiki.rendering.block.XDOM)2 DefaultWikiMacro (org.xwiki.rendering.internal.macro.wikibridge.DefaultWikiMacro)2 MacroManager (org.xwiki.rendering.macro.MacroManager)2 MacroDescriptor (org.xwiki.rendering.macro.descriptor.MacroDescriptor)2 BaseObject (com.xpn.xwiki.objects.BaseObject)1 ArrayList (java.util.ArrayList)1 Expectations (org.jmock.Expectations)1 Before (org.junit.Before)1 Test (org.junit.Test)1 EventListener (org.xwiki.observation.EventListener)1 MacroMarkerBlock (org.xwiki.rendering.block.MacroMarkerBlock)1 ParagraphBlock (org.xwiki.rendering.block.ParagraphBlock)1 WordBlock (org.xwiki.rendering.block.WordBlock)1 ClassBlockMatcher (org.xwiki.rendering.block.match.ClassBlockMatcher)1 DefaultScriptMacro (org.xwiki.rendering.internal.macro.script.DefaultScriptMacro)1