use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method no_persistence_defined_for_field.
@Test
public void no_persistence_defined_for_field() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
try {
model.getFieldPersistenceStrategy("someField");
unreachable();
} catch (IllegalArgumentException ex) {
assertEquals(ex.getMessage(), "No field persistence strategy has been defined for field \'someField\'.");
}
verify();
}
use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method get_persistent_field_names_reflects_parent_model.
@Test
public void get_persistent_field_names_reflects_parent_model() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel parent = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
assertEquals(parent.setFieldPersistenceStrategy("wilma", "session"), "wilma");
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, parent, false, null);
assertEquals(model.setFieldPersistenceStrategy("fred", "session"), "fred");
assertEquals(model.setFieldPersistenceStrategy("barney", "client"), "barney");
assertEquals(model.getPersistentFieldNames(), Arrays.asList("barney", "fred", "wilma"));
verify();
}
use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method set_and_get_meta.
@Test
public void set_and_get_meta() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
model.setMeta("fred", "flintstone");
model.setMeta("barney", "rubble");
assertEquals(model.getMeta("fred"), "flintstone");
assertEquals(model.getMeta("barney"), "rubble");
// Ensure case insensitive:
assertEquals(model.getMeta("FRED"), "flintstone");
assertEquals(model.getMeta("BARNEY"), "rubble");
verify();
}
use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method handles_render_phase.
/**
* @since 5.0.19
*/
@Test
public void handles_render_phase() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
model.addRenderPhase(BeginRender.class);
assertTrue(model.getHandledRenderPhases().contains(BeginRender.class));
verify();
}
use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.
the class MutableComponentModelImplTest method get_persistent_field_names_are_sorted.
@Test
public void get_persistent_field_names_are_sorted() {
Resource r = mockResource();
Logger logger = mockLogger();
replay();
MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
assertEquals(model.setFieldPersistenceStrategy("fred", "session"), "fred");
assertEquals(model.setFieldPersistenceStrategy("barney", "client"), "barney");
assertEquals(model.getPersistentFieldNames(), Arrays.asList("barney", "fred"));
verify();
}
Aggregations