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());
}