Search in sources :

Example 11 with MutableComponentModel

use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.

the class MutableComponentModelImplTest method child_meta_overrides_parent_meta.

@Test
public void child_meta_overrides_parent_meta() {
    Resource r = mockResource();
    Logger logger = mockLogger();
    replay();
    MutableComponentModel parent = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
    MutableComponentModel child = new MutableComponentModelImpl(CLASS_NAME, logger, r, parent, false, null);
    parent.setMeta("fred", "flintstone");
    child.setMeta("fred", "mcmurray");
    assertEquals(parent.getMeta("fred"), "flintstone");
    assertEquals(child.getMeta("fred"), "mcmurray");
    verify();
}
Also used : Resource(org.apache.tapestry5.commons.Resource) MutableComponentModel(org.apache.tapestry5.model.MutableComponentModel) Logger(org.slf4j.Logger) Test(org.testng.annotations.Test)

Example 12 with MutableComponentModel

use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.

the class MutableComponentModelImplTest method get_order_for_mixin_with_parent_model.

@Test
public void get_order_for_mixin_with_parent_model() {
    Resource r = mockResource();
    Logger logger = mockLogger();
    replay();
    MutableComponentModel parent = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
    parent.addMixinClassName("Wilma", "before:Fred");
    MutableComponentModel child = new MutableComponentModelImpl(CLASS_NAME, logger, r, parent, false, null);
    child.addMixinClassName("Fred", "after:Barney");
    child.addMixinClassName("Barney");
    assertEquals(child.getOrderForMixin("Wilma"), new String[] { "before:Fred" });
    assertEquals(child.getOrderForMixin("Fred"), new String[] { "after:Barney" });
    assertEquals(child.getOrderForMixin("Barney"), null);
    verify();
}
Also used : Resource(org.apache.tapestry5.commons.Resource) MutableComponentModel(org.apache.tapestry5.model.MutableComponentModel) Logger(org.slf4j.Logger) Test(org.testng.annotations.Test)

Example 13 with MutableComponentModel

use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.

the class MutableComponentModelImplTest method default_for_supports_informal_parameters_is_false.

@Test
public void default_for_supports_informal_parameters_is_false() {
    Resource r = mockResource();
    Logger logger = mockLogger();
    replay();
    MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
    assertFalse(model.getSupportsInformalParameters());
    model.enableSupportsInformalParameters();
    assertTrue(model.getSupportsInformalParameters());
    verify();
}
Also used : Resource(org.apache.tapestry5.commons.Resource) MutableComponentModel(org.apache.tapestry5.model.MutableComponentModel) Logger(org.slf4j.Logger) Test(org.testng.annotations.Test)

Example 14 with MutableComponentModel

use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.

the class MutableComponentModelImplTest method mixin_order_remembered.

@Test
public void mixin_order_remembered() {
    Resource r = mockResource();
    Logger logger = mockLogger();
    replay();
    MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
    MutableEmbeddedComponentModel fred = model.addEmbeddedComponent("fred", "Fred", COMPONENT_CLASS_NAME, false, null);
    fred.addMixin("zip.zop.Zoom", "before:*", "after:foo.bar.Baz");
    fred.addMixin("foo.bar.Baz");
    assertEquals(fred.getConstraintsForMixin("zip.zop.Zoom"), new String[] { "before:*", "after:foo.bar.Baz" });
    assertEquals(fred.getConstraintsForMixin("foo.bar.Baz"), new String[0]);
    verify();
}
Also used : Resource(org.apache.tapestry5.commons.Resource) MutableComponentModel(org.apache.tapestry5.model.MutableComponentModel) Logger(org.slf4j.Logger) MutableEmbeddedComponentModel(org.apache.tapestry5.model.MutableEmbeddedComponentModel) Test(org.testng.annotations.Test)

Example 15 with MutableComponentModel

use of org.apache.tapestry5.model.MutableComponentModel in project tapestry-5 by apache.

the class MutableComponentModelImplTest method get_parameter_by_name_with_no_parameters_defined.

@Test
public void get_parameter_by_name_with_no_parameters_defined() {
    Resource r = mockResource();
    Logger logger = mockLogger();
    replay();
    MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
    assertNull(model.getParameterModel("foo"));
    verify();
}
Also used : Resource(org.apache.tapestry5.commons.Resource) MutableComponentModel(org.apache.tapestry5.model.MutableComponentModel) Logger(org.slf4j.Logger) Test(org.testng.annotations.Test)

Aggregations

MutableComponentModel (org.apache.tapestry5.model.MutableComponentModel)42 Test (org.testng.annotations.Test)42 Resource (org.apache.tapestry5.commons.Resource)37 Logger (org.slf4j.Logger)37 MutableEmbeddedComponentModel (org.apache.tapestry5.model.MutableEmbeddedComponentModel)10 PlasticField (org.apache.tapestry5.plastic.PlasticField)7 PlasticClass (org.apache.tapestry5.plastic.PlasticClass)6 PlasticMethod (org.apache.tapestry5.plastic.PlasticMethod)4 BeginRender (org.apache.tapestry5.annotations.BeginRender)3 Location (org.apache.tapestry5.commons.Location)3 Annotation (java.lang.annotation.Annotation)2 PersistenceContext (javax.persistence.PersistenceContext)2 SneakyThrows (lombok.SneakyThrows)2 ComponentResources (org.apache.tapestry5.ComponentResources)2 Import (org.apache.tapestry5.annotations.Import)2 InternalComponentResources (org.apache.tapestry5.internal.InternalComponentResources)2 JSONArray (org.apache.tapestry5.json.JSONArray)2 InstanceContext (org.apache.tapestry5.plastic.InstanceContext)2 MethodAdvice (org.apache.tapestry5.plastic.MethodAdvice)2 SessionTracker (com.flowlogix.web.mixins.SessionTracker)1