Search in sources :

Example 16 with MutableComponentModel

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

the class MutableComponentModelImplTest method libraryName_property.

@Test
public void libraryName_property() {
    Resource r = mockResource();
    Logger logger = mockLogger();
    replay();
    MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, "superduper");
    assertEquals(model.getLibraryName(), "superduper");
    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 17 with MutableComponentModel

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

the class MutableComponentModelImplTest method add_parameters_to_embedded.

@Test
public void add_parameters_to_embedded() {
    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);
    assertTrue(fred.getParameterNames().isEmpty());
    fred.addParameter("city", "bedrock");
    fred.addParameter("job", "crane operator");
    assertEquals(fred.getParameterNames(), Arrays.asList("city", "job"));
    assertEquals(fred.getParameterValue("city"), "bedrock");
    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 18 with MutableComponentModel

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

the class MutableComponentModelImplTest method get_parent_from_subclass.

@Test
public void get_parent_from_subclass() {
    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);
    assertSame(child.getParentModel(), parent);
    assertNull(parent.getParentModel());
    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 19 with MutableComponentModel

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

the class MutableComponentModelImplTest method add_embedded_component_with_duplicate_id.

@Test
public void add_embedded_component_with_duplicate_id() {
    Resource r = mockResource();
    Logger logger = mockLogger();
    replay();
    MutableComponentModel model = new MutableComponentModelImpl(CLASS_NAME, logger, r, null, false, null);
    model.addEmbeddedComponent("fred", "Fred1", COMPONENT_CLASS_NAME, false, null);
    try {
        model.addEmbeddedComponent("fred", "Fred2", COMPONENT_CLASS_NAME, false, null);
        unreachable();
    } catch (IllegalArgumentException ex) {
        assertEquals(ex.getMessage(), "Embedded component 'fred' has already been defined for component class org.example.components.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)

Example 20 with MutableComponentModel

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

the class MutableComponentModelImplTest method mixin_names_is_initially_empty_list.

@Test
public void mixin_names_is_initially_empty_list() {
    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);
    assertTrue(fred.getMixinClassNames().isEmpty());
    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)

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