use of org.apache.jasper.el.ELContextImpl in project tomcat70 by apache.
the class TestBeanELResolver method testGetFeatureDescriptors02.
/**
* Tests that a valid FeatureDescriptors are returned.
*/
@Test
public void testGetFeatureDescriptors02() {
BeanELResolver resolver = new BeanELResolver();
ELContext context = new ELContextImpl();
Iterator<FeatureDescriptor> result = resolver.getFeatureDescriptors(context, new Bean());
while (result.hasNext()) {
PropertyDescriptor featureDescriptor = (PropertyDescriptor) result.next();
Assert.assertEquals(featureDescriptor.getPropertyType(), featureDescriptor.getValue(ELResolver.TYPE));
Assert.assertEquals(Boolean.TRUE, featureDescriptor.getValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME));
}
}
use of org.apache.jasper.el.ELContextImpl in project tomcat70 by apache.
the class TestResourceBundleELResolver method testIsReadOnly03.
/**
* Tests that the readOnly is true always when the base is ResourceBundle.
*/
@Test
public void testIsReadOnly03() {
ResourceBundleELResolver resolver = new ResourceBundleELResolver();
ELContext context = new ELContextImpl();
ResourceBundle resourceBundle = new TesterResourceBundle();
boolean result = resolver.isReadOnly(context, resourceBundle, new Object());
Assert.assertTrue(result);
Assert.assertTrue(context.isPropertyResolved());
}
use of org.apache.jasper.el.ELContextImpl in project tomcat70 by apache.
the class TestResourceBundleELResolver method testSetValue03.
/**
* Tests that an exception is thrown because the resolver is read only.
*/
@Test(expected = PropertyNotWritableException.class)
public void testSetValue03() {
ResourceBundleELResolver resolver = new ResourceBundleELResolver();
ELContext context = new ELContextImpl();
ResourceBundle resourceBundle = new TesterResourceBundle();
resolver.setValue(context, resourceBundle, new Object(), new Object());
}
use of org.apache.jasper.el.ELContextImpl in project tomcat70 by apache.
the class TestResourceBundleELResolver method testGetValue03.
/**
* Tests that a valid property is resolved.
*/
@Test
public void testGetValue03() {
ResourceBundleELResolver resolver = new ResourceBundleELResolver();
ELContext context = new ELContextImpl();
ResourceBundle resourceBundle = new TesterResourceBundle();
Object result = resolver.getValue(context, resourceBundle, "key1");
Assert.assertEquals("value1", result);
Assert.assertTrue(context.isPropertyResolved());
result = resolver.getValue(context, resourceBundle, "unknown-key");
Assert.assertEquals("???unknown-key???", result);
Assert.assertTrue(context.isPropertyResolved());
result = resolver.getValue(context, resourceBundle, null);
Assert.assertNull(result);
Assert.assertTrue(context.isPropertyResolved());
}
use of org.apache.jasper.el.ELContextImpl in project tomcat70 by apache.
the class TestMethodExpressionImpl method setUp.
@Before
public void setUp() {
factory = ExpressionFactory.newInstance();
context = new ELContextImpl();
TesterBeanA beanA = new TesterBeanA();
beanA.setName("A");
context.getVariableMapper().setVariable("beanA", factory.createValueExpression(beanA, TesterBeanA.class));
TesterBeanAA beanAA = new TesterBeanAA();
beanAA.setName("AA");
context.getVariableMapper().setVariable("beanAA", factory.createValueExpression(beanAA, TesterBeanAA.class));
TesterBeanAAA beanAAA = new TesterBeanAAA();
beanAAA.setName("AAA");
context.getVariableMapper().setVariable("beanAAA", factory.createValueExpression(beanAAA, TesterBeanAAA.class));
beanB = new TesterBeanB();
beanB.setName("B");
context.getVariableMapper().setVariable("beanB", factory.createValueExpression(beanB, TesterBeanB.class));
TesterBeanBB beanBB = new TesterBeanBB();
beanBB.setName("BB");
context.getVariableMapper().setVariable("beanBB", factory.createValueExpression(beanBB, TesterBeanBB.class));
TesterBeanBBB beanBBB = new TesterBeanBBB();
beanBBB.setName("BBB");
context.getVariableMapper().setVariable("beanBBB", factory.createValueExpression(beanBBB, TesterBeanBBB.class));
TesterBeanC beanC = new TesterBeanC();
context.getVariableMapper().setVariable("beanC", factory.createValueExpression(beanC, TesterBeanC.class));
TesterBeanEnum beanEnum = new TesterBeanEnum();
context.getVariableMapper().setVariable("beanEnum", factory.createValueExpression(beanEnum, TesterBeanEnum.class));
}
Aggregations