alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Struts example source code file (XmlConfigurationProviderUnknownHandlerStackTest.java)

This example Struts source code file (XmlConfigurationProviderUnknownHandlerStackTest.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Struts tags/keywords

configurationexception, configurationexception, configurationprovider, configurationprovider, configurationtestbase, defaultunknownhandlermanager, list, list, string, string, unknownhandlermanager, util, xmlconfigurationproviderunknownhandlerstacktest

The Struts XmlConfigurationProviderUnknownHandlerStackTest.java source code

package com.opensymphony.xwork2.config.providers;

import com.opensymphony.xwork2.UnknownHandlerManager;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.config.entities.UnknownHandlerConfig;
import com.opensymphony.xwork2.DefaultUnknownHandlerManager;

import java.util.List;

public class XmlConfigurationProviderUnknownHandlerStackTest extends ConfigurationTestBase {

    public void testStackWithElements() throws ConfigurationException {
        final String filename = "com/opensymphony/xwork2/config/providers/xwork-unknownhandler-stack.xml";
        ConfigurationProvider provider = buildConfigurationProvider(filename);
        loadConfigurationProviders(provider);
        configurationManager.reload();

        List<UnknownHandlerConfig> unknownHandlerStack = configuration.getUnknownHandlerStack();
        assertNotNull(unknownHandlerStack);
        assertEquals(2, unknownHandlerStack.size());

        assertEquals("uh1", unknownHandlerStack.get(0).getName());
        assertEquals("uh2", unknownHandlerStack.get(1).getName());

        UnknownHandlerManager unknownHandlerManager = new DefaultUnknownHandlerManager();
        container.inject(unknownHandlerManager);
        assertTrue(unknownHandlerManager.hasUnknownHandlers());
    }

    public void testEmptyStack() throws ConfigurationException {
        final String filename = "com/opensymphony/xwork2/config/providers/xwork-unknownhandler-stack-empty.xml";
        ConfigurationProvider provider = buildConfigurationProvider(filename);
        loadConfigurationProviders(provider);
        configurationManager.reload();

        List<UnknownHandlerConfig> unknownHandlerStack = configuration.getUnknownHandlerStack();
        assertNull(unknownHandlerStack);
    }
}

Other Struts examples (source code examples)

Here is a short list of links related to this Struts XmlConfigurationProviderUnknownHandlerStackTest.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.