Package org.apache.shale.clay.config.beans

Examples of org.apache.shale.clay.config.beans.AttributeBean


        ((TemplateConfigBean) htmlTemplateConfigBean).optimizeTree(root);

        assertEquals("#Children", 0, root.getChildren().size());

        AttributeBean attr = root.getAttribute("value");
        assertNotNull(attr);

        assertEquals("root value", "0123456789", attr.getValue());

    }
View Full Code Here


        ((TemplateConfigBean) htmlTemplateConfigBean).optimizeTree(root);

        assertEquals("#Children", 0, root.getChildren().size());

        AttributeBean attr = root.getAttribute("value");
        assertNotNull(attr);

        assertEquals("root value", "0123456789", attr.getValue());

    }
View Full Code Here

        // +6
        // +7 not verbatim
        // +8
        // +9

        AttributeBean attr = null;
        ElementBean child = null;
        ComponentBean root = createVerbatim(ComponentBean.class, "0");
        // root is not a verbatim
        root.setJsfid("outputText");

        child = (ElementBean) createVerbatim(ElementBean.class, "1");
        child.setRenderId(1);
        root.addChild(child);
       

        child = (ElementBean) createVerbatim(ElementBean.class, "2");
        child.setRenderId(2);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "3");
        child.setRenderId(3);
        // root is not a verbatim
        child.setJsfid("outputText");
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "4");
        child.setRenderId(4);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "5");
        child.setRenderId(5);
        // root is not a verbatim
        child.setJsfid("outputText");
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "6");
        child.setRenderId(6);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "7");
        child.setRenderId(7);
        // root is not a verbatim
        child.setJsfid("outputText");
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "8");
        child.setRenderId(8);
        root.addChild(child);

        child = (ElementBean) createVerbatim(ElementBean.class, "9");
        child.setRenderId(9);
        root.addChild(child);

        ((TemplateConfigBean) htmlTemplateConfigBean).optimizeTree(root);

        assertEquals("#Children", 7, root.getChildren().size());

        Iterator ci = root.getChildren().iterator();
        int i = 0;
        while (ci.hasNext()) {
            child = (ElementBean) ci.next();

            switch (++i) {
            case 1: {
                // first two nodes merged
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "12", attr.getValue());
                break;
            }
            case 2: {
                // non-verbatim
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "3", attr.getValue());
                break;
            }
            case 3: {
                // verbatim non-adjacent
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "4", attr.getValue());
                break;
            }
            case 4: {
                // non-verbatim
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "5", attr.getValue());
                break;
            }
            case 5: {
                // verbatim non-adjacent
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "6", attr.getValue());
                break;
            }
            case 6: {
                // non-verbatim
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "7", attr.getValue());
                break;
            }
            case 7: {
                // first two nodes merged
                attr = child.getAttribute("value");
                assertNotNull(attr);
                assertEquals("root value", "89", attr.getValue());
                break;
            }
           
            };
        }
View Full Code Here

       clayAmalgam.clayImport(facesContext, component, displayElement);
      
       assertEquals("jsfid", "outputText", displayElement.getJsfid());
       assertEquals("componentType", "javax.faces.HtmlOutputText", displayElement.getComponentType());
      
       AttributeBean attr = displayElement.getAttribute("escape");
       assertNotNull("escape", attr);
       assertEquals("escape", Boolean.FALSE.toString(), attr.getValue());
      
       attr = displayElement.getAttribute("isTransient");
       assertNotNull("isTransient", attr);
       assertEquals("isTransient", Boolean.TRUE.toString(), attr.getValue());
      
       attr = displayElement.getAttribute("value");
       assertNotNull("value", attr);
       assertEquals("value", "<html><head></head><body bgcolor=\"blue\">Hello World</body></html>", attr.getValue());

       //test excapeXml=false
       component.getAttributes().put("escapeXml", Boolean.FALSE.toString());
       displayElement = new ComponentBean();
       displayElement.setId("clayImport");
       displayElement.setComponentType("org.apache.shale.clay.component.Clay");
       displayElement.setJsfid("clayImport");
     
       clayAmalgam.clayImport(facesContext, component, displayElement);
      
       assertEquals("jsfid", "outputText", displayElement.getJsfid());
       assertEquals("componentType", "javax.faces.HtmlOutputText", displayElement.getComponentType());
      
       attr = displayElement.getAttribute("escape");
       assertNotNull("escape", attr);
       assertEquals("escape", Boolean.FALSE.toString(), attr.getValue());
      
       attr = displayElement.getAttribute("isTransient");
       assertNotNull("isTransient", attr);
       assertEquals("isTransient", Boolean.TRUE.toString(), attr.getValue());
      
       attr = displayElement.getAttribute("value");
       assertNotNull("value", attr);
       assertEquals("value", "<html><head></head><body bgcolor=\"blue\">Hello World</body></html>", attr.getValue());

      
       //test classpath file import
       requestParams = new TreeMap();
       requestParams.put("url", "classpath*:/org/apache/shale/clay/utils/hello.html");
       externalContext.setRequestParameterMap(requestParams);
      
       displayElement = new ComponentBean();
       displayElement.setId("clayImport");
       displayElement.setComponentType("org.apache.shale.clay.component.Clay");
       displayElement.setJsfid("clayImport");
       
       component = application.createComponent("org.apache.shale.clay.component.Clay");    
       component.setId("clayImport");
       component.getAttributes().put("url","#{param.url}");
       component.getAttributes().put("escapeXml", Boolean.TRUE.toString());
      
       clayAmalgam.clayImport(facesContext, component, displayElement);
       attr = displayElement.getAttribute("value");
       assertNotNull("value", attr);
       assertEquals("value", "", attr.getValue());

      
       //test no file found
       requestParams = new TreeMap();
       requestParams.put("url", "/org/apache/shale/clay/utils/notfound.html");
       externalContext.setRequestParameterMap(requestParams);
      
       displayElement = new ComponentBean();
       displayElement.setId("clayImport");
       displayElement.setComponentType("org.apache.shale.clay.component.Clay");
       displayElement.setJsfid("clayImport");
       
       component = application.createComponent("org.apache.shale.clay.component.Clay");    
       component.setId("clayImport");
       component.getAttributes().put("url","#{param.url}");
       component.getAttributes().put("escapeXml", Boolean.TRUE.toString());
      
       clayAmalgam.clayImport(facesContext, component, displayElement);
       attr = displayElement.getAttribute("value");
       assertNotNull("value", attr);
       assertEquals("value", "", attr.getValue());

      
    }
View Full Code Here

        clayAmalgam.clayOut(facesContext, component, displayElement);
       
        assertEquals("jsfid", "outputText", displayElement.getJsfid());
        assertEquals("componentType", "javax.faces.HtmlOutputText", displayElement.getComponentType());
       
        AttributeBean attr = displayElement.getAttribute("escape");
        assertNotNull("escape", attr);
        assertEquals("escape", Boolean.FALSE.toString(), attr.getValue());
       
        attr = displayElement.getAttribute("isTransient");
        assertNotNull("isTransient", attr);
        assertEquals("isTransient", Boolean.TRUE.toString(), attr.getValue());
       
        attr = displayElement.getAttribute("value");
        assertNotNull("value", attr);
        assertEquals("value", "<html><head></head><body bgcolor=\"blue\">Hello World</body></html>", attr.getValue());
         
    }
View Full Code Here

                SymbolBean symbol = clayInclude.getSymbol("@file");
                assertNotNull("file symbol", symbol);
                assertEquals("/org/apache/shale/clay/config/address1.html", symbol.getValue());

                AttributeBean attr = clayInclude.getAttribute("clayJsfid");
                assertNotNull("clayJsfid", attr);
                assertEquals("@file", attr.getValue());


            } else if (clayInclude.getSymbol("@page") != null) {

                SymbolBean symbol = clayInclude.getSymbol("@page");
                assertNotNull("file symbol", symbol);
                assertEquals("/org/apache/shale/clay/config/address1.html", symbol.getValue());

                AttributeBean attr = clayInclude.getAttribute("clayJsfid");
                assertNotNull("clayJsfid", attr);
                assertEquals("@page", attr.getValue());

                for (int i = 0; i < 5; i++) {
                    symbol = clayInclude.getSymbol("@symbol" + i);
                    assertNotNull("@symbol" + i, symbol);
                    assertEquals("value" + i, symbol.getValue());
View Full Code Here

       
        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
            ElementBean child = (ElementBean) ci.next();
           
            AttributeBean attr = null;
            if (child.getId().equals("htmlBegin")) {
                attr = child.getAttribute("value");
                assertEquals("<html>", attr.getValue());
            } else if (child.getId().equals("htmlEnd")) {
                attr = child.getAttribute("value");
                assertEquals("</html>", attr.getValue());
            } else if (child.getId().equals("header")) {
                attr = child.getAttribute("value");
                assertEquals("<head><title>Testing</title></head>", attr.getValue());
            } else if (child.getId().equals("bodyBegin")) {
                attr = child.getAttribute("value");
                assertEquals("<body>", attr.getValue());
            } else if (child.getId().equals("bodyEnd")) {
                attr = child.getAttribute("value");
                assertEquals("</body>", attr.getValue());
            } else if (child.getId().equals("content")) {
                //look for a component that we have setup to test
                checkComponent(child, CUSTOM_HTML_COMPONENTS, true);
            }
        }
View Full Code Here

       
        Iterator ci = bean.getChildrenIterator();
        while (ci.hasNext()) {
            ElementBean child = (ElementBean) ci.next();
           
            AttributeBean attr = null;
            if (child.getId().equals("htmlBegin")) {
                attr = child.getAttribute("value");
                assertEquals("<html>", attr.getValue());
            } else if (child.getId().equals("htmlEnd")) {
                attr = child.getAttribute("value");
                assertEquals("</html>", attr.getValue());
            } else if (child.getId().equals("header")) {
                attr = child.getAttribute("value");
                assertEquals("<head><title>Testing</title></head>", attr.getValue());
            } else if (child.getId().equals("bodyBegin")) {
                attr = child.getAttribute("value");
                assertEquals("<body>", attr.getValue());
            } else if (child.getId().equals("bodyEnd")) {
                attr = child.getAttribute("value");
                assertEquals("</body>", attr.getValue());
            } else if (child.getId().equals("content")) {
                //look for a component that we have setup to test
                checkComponent(child, CUSTOM_HTML_COMPONENTS, true);
            }
        }
View Full Code Here

            Object[] attributes = (Object[]) compData[4];
            for (int i = 0; i < attributes.length; i++) {
                String[] valuepair = (String[]) attributes[i];

                AttributeBean attr = bean.getAttribute(valuepair[0]);
                assertNotNull("check.attribute for " + sarg, attr);
                //System.out.println("\t" + attr.toString());
                assertEquals("check.attribute.value for " + sarg, valuepair[1], attr.getValue());
            }
           
            // the know aggregate object counts
            Integer[] aggregateCnts = (Integer[]) compData[5];
            converterCnt = aggregateCnts[0].intValue();
View Full Code Here

                String name = (String) child.getAttributes().get("name");
                String value = (String) child.getAttributes().get("value");
                String bindingType = (String) child.getAttributes().get("bindingType");

                AttributeBean attr = target.getAttribute(name);
                if (attr != null) {
                    createAttribute(attr, value, target);
                } else {
                    attr = new AttributeBean();
                    attr.setName(name);
                    attr.setValue(value);
                    attr.setBindingType(bindingType);
                    target.addAttribute(attr);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.shale.clay.config.beans.AttributeBean

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.