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\""));
}