Package com.google.code.greenwood.confluenceadvancedcodeblockplugin.macro

Examples of com.google.code.greenwood.confluenceadvancedcodeblockplugin.macro.AdvancedCodeBlockMacro


   
    }
   
  //@Test
  public void testExecute() throws Exception {
    AdvancedCodeBlockMacro macro = new AdvancedCodeBlockMacro();

    Map<String,String> params = new HashMap<String,String>();
    params.put(AdvancedCodeBlockMacro.MACRO_PARAM_ID, "my code");
    params.put(AdvancedCodeBlockMacro.MACRO_PARAM_ENABLEDDL, "true");
  //  params.put(AdvancedCodeBlockMacro.MACRO_PARAM_ENABLERAWDDL, "true");
    params.put(AdvancedCodeBlockMacro.MACRO_PARAM_LANG, "xml");
   
    String html = new AdvancedCodeBlockMacro() {

      @Override
      public Map<String, Object> getDefaultVelocityContext() {
        return new HashMap<String, Object>();
      }
View Full Code Here


  }
 
   
  @Test
  public void testParseConfigWithContent() throws InvalidFileFormatException, IOException {
    AdvancedCodeBlockMacro macro = new AdvancedCodeBlockMacro();

      Map<String, Object>  context = new HashMap<String,Object>();

   
    String[] splitted = BaseAdvancedCodeblockMacro.splitMacroBodyIntoContentAndConfig(configWithContent);
    String configUnparsed = splitted[0];
    String contentUnparsed = splitted[1];
    List<Map<String, String>> codeblocks = macro.parseConfigWithContent(configUnparsed, contentUnparsed, "key", 1l, context, true);
   
    assertEquals("\nmy replacable awesome text <html>", codeblocks.get(0).get(AdvancedCodeBlockMacro.VELOCITY_PLACEHOLDER_CODE).toString());
    assertEquals("config 1", codeblocks.get(0).get(AdvancedCodeBlockMacro.VELOCITY_PLACEHOLDER_TITLE).toString());
   
    assertEquals("\nmy replacable great text <html>", codeblocks.get(1).get(AdvancedCodeBlockMacro.VELOCITY_PLACEHOLDER_CODE).toString());
View Full Code Here

  }
 
 
  @Test
  public void testVelocityOutput() throws Exception {
    AdvancedCodeBlockMacro macro = new AdvancedCodeBlockMacro();

    VelocityContext context = new VelocityContext();
    Map<String, Object>  innercontext = new HashMap<String,Object>();
    String[] splitted = BaseAdvancedCodeblockMacro.splitMacroBodyIntoContentAndConfig(configWithContent);
    String configUnparsed = splitted[0];
    String contentUnparsed = splitted[1];
      context.put("codeblocks",macro.parseConfigWithContent(configUnparsed, contentUnparsed, "key", 1l, innercontext, true));
      for (Entry<String,Object> entry : innercontext.entrySet()) {
        context.put(entry.getKey(), entry.getValue());
      }
      StringWriter writer = new StringWriter();
     
View Full Code Here

TOP

Related Classes of com.google.code.greenwood.confluenceadvancedcodeblockplugin.macro.AdvancedCodeBlockMacro

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.