Package com.dotmarketing.plugin.util

Examples of com.dotmarketing.plugin.util.PluginFileMerger


public class PluginMergerTest extends TestBase {

   @Test
  public void testMergeByAttribute() throws IOException {
    PluginFileMerger fileMerger = new PluginFileMerger();

    String name = "override-test";

    StringBuilder sb = new StringBuilder();
    String newline = System.getProperty("line.separator");

    sb.append("<create creator=\"new\" javascript=\"UserAjax\" scope=\"application\">");
    sb.append(newline).append("<param name=\"class\" value=\"com.mycompany.plugins.ajax.MyCompanyUserAjax\"/>");
    sb.append(newline).append("</create>");

    String dwr = sb.toString();

    Map<String,String> overrideMap = new HashMap<String, String>();
    overrideMap.put("create", "javascript");
    sb = new StringBuilder("<!DOCTYPE dwr PUBLIC \"-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN\" \"http://getahead.org/dwr//dwr30.dtd\">");
    sb.append("<dwr>");
    sb.append("<allow>");
    sb.append("<create creator=\"new\" javascript=\"UserAjax\" scope=\"application\">");
    sb.append("<param name=\"class\" value=\"com.dotmarketing.portlets.user.ajax.UserAjax\"/>");
    sb.append("</create>");
    sb.append("<!-- Don't ever delete the following comment tags, it will break the plugin system -->");
    sb.append("<!-- BEGIN PLUGINS -->");
    sb.append("<!-- END PLUGINS -->");
    sb.append("</allow>");
    sb.append("</dwr>");

    InputStream input = new ByteArrayInputStream(sb.toString().getBytes());

    String fileContent = fileMerger.mergeByAttribute(input, "<!-- BEGIN PLUGINS -->",
        "<!-- END PLUGINS -->", "<!-- BEGIN PLUGIN:" + name + " -->", "<!-- END PLUGIN:" + name + " -->", dwr,
        overrideMap, "<!-- BEGIN OVERRIDE:" + name, " END OVERRIDE:" + name + " -->", "<!-- BEGIN OVERRIDE");


    sb = new StringBuilder("<!-- BEGIN OVERRIDE:override-test");
View Full Code Here

TOP

Related Classes of com.dotmarketing.plugin.util.PluginFileMerger

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.