Search in sources :

Example 6 with UnknownHandlerManager

use of com.opensymphony.xwork2.UnknownHandlerManager in project struts by apache.

the class UnknownHandlerManagerTest method testEmptyStack.

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();
    UnknownHandlerManager unknownHandlerManager = new DefaultUnknownHandlerManager();
    container.inject(unknownHandlerManager);
    List<UnknownHandler> unknownHandlers = unknownHandlerManager.getUnknownHandlers();
    assertNotNull(unknownHandlers);
    assertEquals(2, unknownHandlers.size());
    UnknownHandler uh1 = unknownHandlers.get(0);
    UnknownHandler uh2 = unknownHandlers.get(1);
    assertTrue(uh1 instanceof SomeUnknownHandler);
    assertTrue(uh2 instanceof SomeUnknownHandler);
}
Also used : DefaultUnknownHandlerManager(com.opensymphony.xwork2.DefaultUnknownHandlerManager) UnknownHandler(com.opensymphony.xwork2.UnknownHandler) SomeUnknownHandler(com.opensymphony.xwork2.config.providers.SomeUnknownHandler) ConfigurationProvider(com.opensymphony.xwork2.config.ConfigurationProvider) SomeUnknownHandler(com.opensymphony.xwork2.config.providers.SomeUnknownHandler) DefaultUnknownHandlerManager(com.opensymphony.xwork2.DefaultUnknownHandlerManager) UnknownHandlerManager(com.opensymphony.xwork2.UnknownHandlerManager)

Example 7 with UnknownHandlerManager

use of com.opensymphony.xwork2.UnknownHandlerManager in project struts by apache.

the class XmlConfigurationProviderUnknownHandlerStackTest method testStackWithElements.

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());
}
Also used : UnknownHandlerConfig(com.opensymphony.xwork2.config.entities.UnknownHandlerConfig) DefaultUnknownHandlerManager(com.opensymphony.xwork2.DefaultUnknownHandlerManager) ConfigurationProvider(com.opensymphony.xwork2.config.ConfigurationProvider) DefaultUnknownHandlerManager(com.opensymphony.xwork2.DefaultUnknownHandlerManager) UnknownHandlerManager(com.opensymphony.xwork2.UnknownHandlerManager)

Aggregations

MockActionProxy (com.opensymphony.xwork2.mock.MockActionProxy)4 OgnlUtil (com.opensymphony.xwork2.ognl.OgnlUtil)4 DefaultUnknownHandlerManager (com.opensymphony.xwork2.DefaultUnknownHandlerManager)3 UnknownHandlerManager (com.opensymphony.xwork2.UnknownHandlerManager)3 ConfigurationProvider (com.opensymphony.xwork2.config.ConfigurationProvider)3 UnknownHandler (com.opensymphony.xwork2.UnknownHandler)2 SomeUnknownHandler (com.opensymphony.xwork2.config.providers.SomeUnknownHandler)2 UnknownHandlerConfig (com.opensymphony.xwork2.config.entities.UnknownHandlerConfig)1