Package org.apache.commons.chain.impl

Examples of org.apache.commons.chain.impl.CatalogBase


    /**
     * <p>Test adding a specifically named {@link Catalog} instance.</p>
     */
    public void testSpecificCatalog() {

        Catalog catalog = new CatalogBase();
        factory.setCatalog(catalog);
        catalog = new CatalogBase();
        factory.addCatalog("foo", catalog);
        assertTrue(catalog == factory.getCatalog("foo"));
        assertEquals(1, getCatalogCount());
        factory.addCatalog("foo", new CatalogBase());
        assertEquals(1, getCatalogCount());
        assertTrue(!(catalog == factory.getCatalog("foo")));
        CatalogFactory.clear();
        factory = CatalogFactory.getInstance();
        assertEquals(0, getCatalogCount());
View Full Code Here


    /**
     * <p>Test <code>getCatalog()</code> method.</p>
     */
    public void testCatalogIdentifier() {

        Catalog defaultCatalog = new CatalogBase();
        Command defaultFoo = new NonDelegatingCommand();
        defaultCatalog.addCommand("foo", defaultFoo);
        Command fallback = new NonDelegatingCommand();
        defaultCatalog.addCommand("noSuchCatalog:fallback", fallback);

        factory.setCatalog(defaultCatalog);

        Catalog specificCatalog = new CatalogBase();
        Command specificFoo = new NonDelegatingCommand();
        specificCatalog.addCommand("foo", specificFoo);
        factory.addCatalog("specific", specificCatalog);

        Command command = factory.getCommand("foo");
        assertSame(defaultFoo, command);

View Full Code Here

    /**
     * <p>Test the default {@link Catalog} instance.</p>
     */
    public void testDefaultCatalog() {

        Catalog catalog = new CatalogBase();
        factory.setCatalog(catalog);
        assertTrue(catalog == factory.getCatalog());
        assertEquals(0, getCatalogCount());

    }
View Full Code Here

    /**
     * <p>Test adding a specifically named {@link Catalog} instance.</p>
     */
    public void testSpecificCatalog() {

        Catalog catalog = new CatalogBase();
        factory.setCatalog(catalog);
        catalog = new CatalogBase();
        factory.addCatalog("foo", catalog);
        assertTrue(catalog == factory.getCatalog("foo"));
        assertEquals(1, getCatalogCount());
        factory.addCatalog("foo", new CatalogBase());
        assertEquals(1, getCatalogCount());
        assertTrue(!(catalog == factory.getCatalog("foo")));
        CatalogFactory.clear();
        factory = CatalogFactory.getInstance();
        assertEquals(0, getCatalogCount());
View Full Code Here

    /**
     * <p>Test <code>getCatalog()</code> method.</p>
     */
    public void testCatalogIdentifier() {

        Catalog defaultCatalog = new CatalogBase();
        Command defaultFoo = new NonDelegatingCommand();
        defaultCatalog.addCommand("foo", defaultFoo);
        Command fallback = new NonDelegatingCommand();
        defaultCatalog.addCommand("noSuchCatalog:fallback", fallback);

        factory.setCatalog(defaultCatalog);

        Catalog specificCatalog = new CatalogBase();
        Command specificFoo = new NonDelegatingCommand();
        specificCatalog.addCommand("foo", specificFoo);
        factory.addCatalog("specific", specificCatalog);

        Command command = factory.getCommand("foo");
        assertSame(defaultFoo, command);

View Full Code Here

        // Retrieve or create the Catalog instance we may be updating
        Catalog catalog = null;
        if (attr != null) {
            catalog = (Catalog) context.getAttribute(attr);
            if (catalog == null) {
                catalog = new CatalogBase();
            }
        }

        // Construct the configuration resource parser we will use
        ConfigParser parser = new ConfigParser();
View Full Code Here

        // Retrieve or create the Catalog instance we may be updating
        Catalog catalog = null;
        if (attr != null) {
            catalog = (Catalog) context.getAttribute(attr);
            if (catalog == null) {
                catalog = new CatalogBase();
            }
        }

        // Construct the configuration resource parser we will use
        ConfigParser parser = new ConfigParser();
View Full Code Here

    /**
     * Set up instance variables required by this test case.
     */
    public void setUp() {
        catalog = new CatalogBase();
        CatalogFactoryBase.getInstance().setCatalog(catalog);
        command = new LookupCommand();       
        context = new ContextBase();
    }
View Full Code Here

    /**
     * Set up instance variables required by this test case.
     */
    public void setUp() {
        catalog = new CatalogBase();
        CatalogFactoryBase.getInstance().setCatalog(catalog);
        command = new DispatchLookupCommand();       
        context = new ContextBase();
    }
View Full Code Here

        // Retrieve or create the Catalog instance we will be updating
        Catalog catalog = (Catalog)
            servlet.getServletContext().getAttribute(Constants.CATALOG_ATTR);
        if (catalog == null) {
            log.info("Creating new Catalog instance");
            catalog = new CatalogBase();
            servlet.getServletContext().setAttribute(Constants.CATALOG_ATTR,
                                                     catalog);
        }

        // Add or replace chain definitions from the specified resource
View Full Code Here

TOP

Related Classes of org.apache.commons.chain.impl.CatalogBase

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.