use of org.apache.tapestry5.commons.Resource in project tapestry-5 by apache.
the class ClasspathAssetAliasManagerImplTest method can_not_map_resource_path_that_matches_virtual_folder.
@Test
public void can_not_map_resource_path_that_matches_virtual_folder() throws IOException {
Resource r = mockResource();
expect(r.getPath()).andReturn("com/example/mylib");
replay();
ClasspathAssetAliasManager manager = new ClasspathAssetAliasManagerImpl(configuration());
try {
manager.extractAssetAlias(r);
unreachable();
} catch (IllegalArgumentException ex) {
}
verify();
}
use of org.apache.tapestry5.commons.Resource in project tapestry-5 by apache.
the class ClasspathAssetAliasManagerImplTest method to_client_url.
@Test(dataProvider = "to_client_url_data")
public void to_client_url(String resourcePath, String expectedFolder, String expectedPath) throws IOException {
Resource r = mockResource();
expect(r.getPath()).andReturn(resourcePath);
replay();
ClasspathAssetAliasManager manager = new ClasspathAssetAliasManagerImpl(configuration());
AssetAlias alias = manager.extractAssetAlias(r);
assertEquals(alias.virtualFolder, expectedFolder);
assertEquals(alias.path, expectedPath);
verify();
}
use of org.apache.tapestry5.commons.Resource 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.commons.Resource 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();
}
use of org.apache.tapestry5.commons.Resource 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();
}
Aggregations