Package de.odysseus.calyxo.control.base

Examples of de.odysseus.calyxo.control.base.ControlModuleContext


  }

  public void testDispatcher() throws ConfigException {
    ServletConfig config = new TestServletConfig("test");
    ControlModuleMapping mapping = new ControlModuleMapping("/test/*");
    ControlModuleContext module = new ControlModuleContext(config, mapping, null);
    PluginContext context = new PluginContext(module, DefaultAction.class, new DefaultDispatcher(module));
    DefaultDispatcher dispatcher = new DefaultDispatcher(context.getModuleContext());

    assertNull(context.getDispatcher("foo"));
    context.setDispatcher("foo", dispatcher);
View Full Code Here


  }

  public void testFilterClass() throws ConfigException {
    ServletConfig config = new TestServletConfig("test");
    ControlModuleMapping mapping = new ControlModuleMapping("/test/*");
    ControlModuleContext module = new ControlModuleContext(config, mapping, null);
    PluginContext context = new PluginContext(module, DefaultAction.class, new DefaultDispatcher(module));

    assertNull(context.getFilterClass("foo"));
    context.setFilterClass("foo", CancelFilter.class);
    try {
View Full Code Here

    TestServletConfig config = new TestServletConfig("test", params);
    ControlModuleMapping mapping = new ControlModuleMapping("/test/*");

    ServletContext context = config.getServletContext();
    ControlModuleGroup group = ControlModuleGroup.getInstance(context);
    ControlModuleContext module = new ControlModuleContext(config, mapping, null);
    assertTrue(group.isEmpty());
    group.add(module);
    assertFalse(group.isEmpty());
    assertSame(module, group.getControlModuleContext("test"));
    TestRequest request = new TestRequest(new TestSession(module.getServletContext()));
    group.setControlModuleContext(request, module);
    assertSame(module, ModuleSupport.getInstance(context).getModuleContext(request));
    group.remove(module);
    assertTrue(group.isEmpty());
  }
View Full Code Here

  }

  public void testBasics() throws ConfigException {
    ServletConfig config = new TestServletConfig("test");
    ControlModuleMapping mapping = new ControlModuleMapping("/test/*");
    ControlModuleContext context = new ControlModuleContext(config, mapping, null);
   
    assertSame("test", context.getName());
    assertSame(config.getServletContext(), context.getServletContext());
    assertEquals("/test/action", context.getPath("/action"));
  }
View Full Code Here

  }

  public void testModuleAttributes() throws ConfigException {
    ServletConfig config = new TestServletConfig("test");
    ControlModuleMapping mapping = new ControlModuleMapping("/test/*");
    ControlModuleContext context = new ControlModuleContext(config, mapping, null);

    assertNull(context.getAttribute("foo"));
    context.setAttribute("foo", "bar");
    assertSame("bar", context.getAttribute("foo"));
    context.removeAttribute("foo");
    assertNull(context.getAttribute("foo"));
  }
View Full Code Here

  public void testInitParams() throws ConfigException {
    HashMap params = new HashMap();
    params.put("foo", "bar");
    TestServletConfig config = new TestServletConfig("test", params);
    ControlModuleMapping mapping = new ControlModuleMapping("/test/*");
    ControlModuleContext module = new ControlModuleContext(config, mapping, null);

    assertNull(module.getInitParameter("bar"));
    assertSame("bar", module.getInitParameter("foo"));
  }
View Full Code Here

  }

  private DefaultModule createModule(ServletContext context, String name, String pattern, Map params) throws ConfigException, ServletException {
    TestServletConfig config = new TestServletConfig(name, context, params);
    DefaultModule module = new DefaultModule();
    module.init(new ControlModuleContext(config, new ControlModuleMapping(pattern), null));
    return module;
  }
View Full Code Here

    }
    ControlModuleMapping mapping = (ControlModuleMapping)list.get(0);
    log.info("Associating module '" + name + "' with '" + mapping.getPath("*") + "'");

    // create module context
    context = new ControlModuleContext(getServletConfig(), mapping, null);

    // create module
    String type = context.getInitParameter("module-class");
    if (type == null) {
      type = DEFAULT_MODULE;
View Full Code Here

TOP

Related Classes of de.odysseus.calyxo.control.base.ControlModuleContext

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.