use of org.apache.tapestry5.ComponentResources in project tapestry-5 by apache.
the class ComponentDefaultProviderImplTest method no_matching_property_for_default.
@Test
public void no_matching_property_for_default() {
String parameterName = "myparam";
String id = "mycomponentid";
ComponentResources resources = mockComponentResources();
Component container = mockComponent();
PropertyAccess access = mockPropertyAccess();
ClassPropertyAdapter classPropertyAdapter = mockClassPropertyAdapter();
BindingSource bindingSource = mockBindingSource();
train_getId(resources, id);
train_getContainer(resources, container);
train_getAdapter(access, container, classPropertyAdapter);
train_getPropertyAdapter(classPropertyAdapter, id, null);
replay();
ComponentDefaultProvider source = new ComponentDefaultProviderImpl(access, bindingSource, null, null, null);
assertNull(source.defaultBinding(parameterName, resources));
verify();
}
use of org.apache.tapestry5.ComponentResources in project tapestry-5 by apache.
the class BindingSourceImplTest method expression_has_no_prefix.
@Test
public void expression_has_no_prefix() {
BindingFactory factory = mockBindingFactory();
Binding binding = mockBinding();
ComponentResources container = mockComponentResources();
ComponentResources component = mockComponentResources();
Location l = mockLocation();
String defaultPrefix = "def";
String description = "descrip";
String expression = "full expression";
train_newBinding(factory, description, container, component, expression, l, binding);
replay();
Map<String, BindingFactory> map = newMap();
map.put(defaultPrefix, factory);
BindingSource source = new BindingSourceImpl(map, interner);
Binding actual = source.newBinding(description, container, component, defaultPrefix, expression, l);
assertSame(actual, binding);
verify();
}
use of org.apache.tapestry5.ComponentResources in project tapestry-5 by apache.
the class BindingSourceImplTest method expression_prefix_not_in_configuration.
@Test
public void expression_prefix_not_in_configuration() {
BindingFactory factory = mockBindingFactory();
Binding binding = mockBinding();
ComponentResources container = mockComponentResources();
ComponentResources component = mockComponentResources();
Location l = mockLocation();
String defaultPrefix = "def";
String description = "descrip";
String expression = "javascript:not-a-known-prefix";
train_newBinding(factory, description, container, component, expression, l, binding);
replay();
Map<String, BindingFactory> map = newMap();
map.put(defaultPrefix, factory);
BindingSource source = new BindingSourceImpl(map, interner);
Binding actual = source.newBinding(description, container, component, defaultPrefix, expression, l);
assertSame(actual, binding);
verify();
}
use of org.apache.tapestry5.ComponentResources in project tapestry-5 by apache.
the class BindingFactoryTest method symbol_binding.
@Test
public void symbol_binding() {
ComponentResources res = mockInternalComponentResources();
Location l = mockLocation();
replay();
BindingFactory factory = getService("SymbolBindingFactory", BindingFactory.class);
Binding binding = factory.newBinding("Test binding", res, null, SymbolConstants.START_PAGE_NAME, l);
assertEquals(binding.get(), "start");
verify();
}
use of org.apache.tapestry5.ComponentResources in project tapestry-5 by apache.
the class PropBindingFactoryTest method property_path_through_write_only_property.
@Test
public void property_path_through_write_only_property() {
TargetBean bean = new TargetBean();
ComponentResources resources = mockComponentResources();
Location l = mockLocation();
train_getComponent(resources, bean);
replay();
String propertyPath = "writeOnly.terminalProperty";
try {
factory.newBinding("test binding", resources, null, propertyPath, l);
unreachable();
} catch (RuntimeException ex) {
assertMessageContains(ex, "Property \'writeOnly\' of class org.apache.tapestry5.internal.bindings.TargetBean", "is not readable (it has no read accessor method).");
}
verify();
}
Aggregations