Package org.apache.shale.clay.component.chain

Examples of org.apache.shale.clay.component.chain.CreateComponentCommand


        clayContext.setParent(parent);
        clayContext.setDisplayElement(displayElement);
        clayContext.setSymbols(displayElement.getSymbols());
        clayContext.setJspIds(new TreeSet());
               
        Command command = new CreateComponentCommand();
        boolean isFinal = command.execute(clayContext);
        assertEquals("command finished", false, isFinal);
       
        UIComponent child = (UIComponent) clayContext.getChild();
        assertNotNull("child", child);
       
        assertEquals("id = test", "test", child.getId());
       
       
        //null component id symbol replacement
        parent = (UIComponent)
             facesContext.getApplication().createComponent("javax.faces.NamingContainer");
        assertNotNull("javax.faces.NamingContainer", parent);
        parent.setId("parent");
       
        displayElement = new ComponentBean();
        displayElement.setJsfid("inputText");
        displayElement.setComponentType("javax.faces.HtmlOutputText");
        displayElement.setId("@wynn");
        displayElement.addSymbol(createSymbol("@wynn", null));
       
        clayContext = new ClayContext();
        clayContext.setFacesContext(facesContext);
        clayContext.setParent(parent);
        clayContext.setDisplayElement(displayElement);
        clayContext.setSymbols(displayElement.getSymbols());
        clayContext.setJspIds(new TreeSet());
               
        command = new CreateComponentCommand();
        try {
            isFinal = command.execute(clayContext);
            assertTrue("id replacement failed", false);
        } catch (RuntimeException e) {
            assertTrue("null component id",
                    e.getMessage().startsWith("The component symbol substitution failed for id \"@wynn\""));   
        }
       
        //missing component id symbol replacement
        parent = (UIComponent)
             facesContext.getApplication().createComponent("javax.faces.NamingContainer");
        assertNotNull("javax.faces.NamingContainer", parent);
        parent.setId("parent");
       
        displayElement = new ComponentBean();
        displayElement.setJsfid("inputText");
        displayElement.setComponentType("javax.faces.HtmlOutputText");
        displayElement.setId("@wynn");
       
        clayContext = new ClayContext();
        clayContext.setFacesContext(facesContext);
        clayContext.setParent(parent);
        clayContext.setDisplayElement(displayElement);
        clayContext.setSymbols(displayElement.getSymbols());
        clayContext.setJspIds(new TreeSet());
               
        command = new CreateComponentCommand();
        try {
            isFinal = command.execute(clayContext);
            assertTrue("id replacement failed", false);
        } catch (RuntimeException e) {
            assertTrue("missing component id",
                    e.getMessage().startsWith("The component symbol substitution failed for id \"@wynn\""));   
        }
View Full Code Here

TOP

Related Classes of org.apache.shale.clay.component.chain.CreateComponentCommand

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.