resetCallbacks(childCallback, facetCallback, immediateFacetCallback);
}
public void testSaveRestoreChildrenState() throws Exception {
HtmlForm form = new HtmlForm();
HtmlInputText input = new HtmlInputText();
IterationStateHolderComponent stateHolder = new IterationStateHolderComponent();
List<UIComponent> children = mockDataAdaptor.getChildren();
children.add(form);
form.getChildren().add(input);
form.getFacets().put("facet", stateHolder);
mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));
assertFalse(form.isSubmitted());
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
assertNull(stateHolder.getIterationState());
form.setSubmitted(true);
input.setSubmittedValue("user input");
input.setValue("component value");
input.setValid(false);
input.setLocalValueSet(true);
stateHolder.setIterationState("state");
mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
assertFalse(form.isSubmitted());
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
assertNull(stateHolder.getIterationState());
input.setSubmittedValue("another input from user");
input.setValue("123");
assertTrue(input.isLocalValueSet());
stateHolder.setIterationState("456");
mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(0));
assertTrue(form.isSubmitted());
assertEquals("user input", input.getSubmittedValue());
assertEquals("component value", input.getLocalValue());
assertFalse(input.isValid());
assertTrue(input.isLocalValueSet());
assertEquals("state", stateHolder.getIterationState());
mockDataAdaptor.setRowKey(facesContext, Integer.valueOf(1));
assertFalse(form.isSubmitted());
assertEquals("another input from user", input.getSubmittedValue());
assertEquals("123", input.getLocalValue());
assertTrue(input.isValid());
assertTrue(input.isLocalValueSet());
assertEquals("456", stateHolder.getIterationState());
mockDataAdaptor.setRowKey(facesContext, null);
assertFalse(form.isSubmitted());
assertNull(input.getSubmittedValue());
assertNull(input.getLocalValue());
assertTrue(input.isValid());
assertFalse(input.isLocalValueSet());
assertNull(stateHolder.getIterationState());
}