Package de.odysseus.calyxo.control.base

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


    params.put(
      "config",
      "/de/odysseus/calyxo/control/calyxo-control-config-empty.xml"
    );
    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());
View Full Code Here


    ControlModuleMappings mappings =
      new ControlModuleMappings(getClass().getResourceAsStream("web.xml"));

    List list = mappings.getMappings("module1");
    assertEquals(1, list.size());
    ControlModuleMapping mapping = (ControlModuleMapping)list.get(0);
    assertNull(mapping.getPrefix());
    assertEquals(".module1", mapping.getExtension());
  }
View Full Code Here

    ControlModuleMappings mappings =
      new ControlModuleMappings(getClass().getResourceAsStream("web.xml"));

    List list = mappings.getMappings("module2");
    assertEquals(1, list.size());
    ControlModuleMapping mapping = (ControlModuleMapping)list.get(0);
    assertEquals("/module2", mapping.getPrefix());
    assertNull(mapping.getExtension());
  }
View Full Code Here

    ControlModuleMappings mappings =
      new ControlModuleMappings(getClass().getResourceAsStream("web.xml"));

    List list = mappings.getMappings("module3");
    assertEquals(2, list.size());
    ControlModuleMapping mapping1 = (ControlModuleMapping)list.get(0);
    ControlModuleMapping mapping2 = (ControlModuleMapping)list.get(1);
    assertEquals("/module3", mapping1.getPrefix());
    assertNull(mapping1.getExtension());
    assertNull(mapping2.getPrefix());
    assertEquals(".module3", mapping2.getExtension());
  }
View Full Code Here

    super(arg0);
  }

  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

    assertEquals("/test/action", context.getPath("/action"));
  }

  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"));
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

    // get module mapping
    List list = ControlModuleMappings.getInstance(getServletContext()).getMappings(name);
    if (list.size() != 1) {
      throw new ServletException("There must be exactly one servlet mapping for module '" + name + "'");
    }
    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
View Full Code Here

TOP

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

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.