Search in sources :

Example 16 with Resource

use of org.apache.tapestry5.commons.Resource 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 17 with Resource

use of org.apache.tapestry5.commons.Resource 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 18 with Resource

use of org.apache.tapestry5.commons.Resource 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 19 with Resource

use of org.apache.tapestry5.commons.Resource 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)

Example 20 with Resource

use of org.apache.tapestry5.commons.Resource 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)

Aggregations

Resource (org.apache.tapestry5.commons.Resource)78 Test (org.testng.annotations.Test)62 MutableComponentModel (org.apache.tapestry5.model.MutableComponentModel)38 Logger (org.slf4j.Logger)38 ClasspathResource (org.apache.tapestry5.ioc.internal.util.ClasspathResource)16 Asset (org.apache.tapestry5.Asset)14 ComponentModel (org.apache.tapestry5.model.ComponentModel)10 MutableEmbeddedComponentModel (org.apache.tapestry5.model.MutableEmbeddedComponentModel)10 ComponentTemplate (org.apache.tapestry5.internal.parser.ComponentTemplate)6 AssetFactory (org.apache.tapestry5.services.AssetFactory)6 IOException (java.io.IOException)5 AssetSource (org.apache.tapestry5.services.AssetSource)5 ComponentResourceLocator (org.apache.tapestry5.services.pageload.ComponentResourceLocator)5 Context (org.apache.tapestry5.http.services.Context)4 BeginRender (org.apache.tapestry5.annotations.BeginRender)3 Location (org.apache.tapestry5.commons.Location)3 AbstractResource (org.apache.tapestry5.ioc.internal.util.AbstractResource)3 ThreadLocale (org.apache.tapestry5.ioc.services.ThreadLocale)3 ClasspathAssetAliasManager (org.apache.tapestry5.services.ClasspathAssetAliasManager)3 StreamableResource (org.apache.tapestry5.services.assets.StreamableResource)3