Author: violetagg Date: Tue Jul 9 19:25:22 2013 New Revision: 1501478 URL: http://svn.apache.org/r1501478 Log: Merged revision 1501266 from tomcat/trunk: javax.el.MapELResolver: 1. According to javadoc when creating FeatureDescriptors - ShortDescription must be empty string - ELResolver.RESOLVABLE_AT_DESIGN_TIME must be TRUE 2. Unit tests are added
Added: tomcat/tc7.0.x/trunk/test/javax/el/TestMapELResolver.java - copied, changed from r1501266, tomcat/trunk/test/javax/el/TestMapELResolver.java Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/javax/el/MapELResolver.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1501266 Modified: tomcat/tc7.0.x/trunk/java/javax/el/MapELResolver.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/javax/el/MapELResolver.java?rev=1501478&r1=1501477&r2=1501478&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/javax/el/MapELResolver.java (original) +++ tomcat/tc7.0.x/trunk/java/javax/el/MapELResolver.java Tue Jul 9 19:25:22 2013 @@ -124,11 +124,12 @@ public class MapELResolver extends ELRes key = itr.next(); desc = new FeatureDescriptor(); desc.setDisplayName(key.toString()); + desc.setShortDescription(""); desc.setExpert(false); desc.setHidden(false); desc.setName(key.toString()); desc.setPreferred(true); - desc.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.FALSE); + desc.setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE); desc.setValue(TYPE, key.getClass()); feats.add(desc); } Copied: tomcat/tc7.0.x/trunk/test/javax/el/TestMapELResolver.java (from r1501266, tomcat/trunk/test/javax/el/TestMapELResolver.java) URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/javax/el/TestMapELResolver.java?p2=tomcat/tc7.0.x/trunk/test/javax/el/TestMapELResolver.java&p1=tomcat/trunk/test/javax/el/TestMapELResolver.java&r1=1501266&r2=1501478&rev=1501478&view=diff ============================================================================== --- tomcat/trunk/test/javax/el/TestMapELResolver.java (original) +++ tomcat/tc7.0.x/trunk/test/javax/el/TestMapELResolver.java Tue Jul 9 19:25:22 2013 @@ -25,6 +25,8 @@ import java.util.Map; import org.junit.Assert; import org.junit.Test; +import org.apache.jasper.el.ELContextImpl; + public class TestMapELResolver { /** @@ -51,11 +53,10 @@ public class TestMapELResolver { @Test public void testGetType03() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - Class<?> result = mapELResolver.getType(context, new HashMap<>(), - "test"); + Class<?> result = mapELResolver.getType(context, + new HashMap<Object, Object>(), "test"); Assert.assertEquals(Object.class, result); Assert.assertTrue(context.isPropertyResolved()); @@ -85,10 +86,9 @@ public class TestMapELResolver { @Test public void testGetValue03() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - Map<String, String> map = new HashMap<>(); + Map<String, String> map = new HashMap<String, String>(); map.put("key", "value"); Object result = mapELResolver.getValue(context, map, "key"); @@ -125,11 +125,10 @@ public class TestMapELResolver { @Test(expected = PropertyNotWritableException.class) public void testSetValue03() { MapELResolver mapELResolver = new MapELResolver(true); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - mapELResolver.setValue(context, new HashMap<>(), new Object(), - new Object()); + mapELResolver.setValue(context, new HashMap<Object, Object>(), + new Object(), new Object()); } /** @@ -138,10 +137,9 @@ public class TestMapELResolver { @Test public void testSetValue04() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - Map<String, String> map = new HashMap<>(); + Map<String, String> map = new HashMap<String, String>(); mapELResolver.setValue(context, map, "key", "value"); Assert.assertEquals("value", @@ -155,10 +153,10 @@ public class TestMapELResolver { @Test(expected = PropertyNotWritableException.class) public void testSetValue05() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - Map<Object, Object> map = Collections.unmodifiableMap(new HashMap<>()); + Map<Object, Object> map = Collections + .unmodifiableMap(new HashMap<Object, Object>()); mapELResolver.setValue(context, map, "key", "value"); } @@ -177,8 +175,7 @@ public class TestMapELResolver { @Test public void testIsReadOnly02() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); boolean result = mapELResolver.isReadOnly(context, new Object(), new Object()); @@ -201,19 +198,18 @@ public class TestMapELResolver { @Test public void testIsReadOnly03() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - boolean result = mapELResolver.isReadOnly(context, new HashMap<>(), - new Object()); + boolean result = mapELResolver.isReadOnly(context, + new HashMap<Object, Object>(), new Object()); Assert.assertFalse(result); Assert.assertTrue(context.isPropertyResolved()); mapELResolver = new MapELResolver(true); - result = mapELResolver.isReadOnly(context, new HashMap<>(), - new Object()); + result = mapELResolver.isReadOnly(context, + new HashMap<Object, Object>(), new Object()); Assert.assertTrue(result); Assert.assertTrue(context.isPropertyResolved()); @@ -225,10 +221,10 @@ public class TestMapELResolver { @Test public void testIsReadOnly04() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - Map<Object, Object> map = Collections.unmodifiableMap(new HashMap<>()); + Map<Object, Object> map = Collections + .unmodifiableMap(new HashMap<Object, Object>()); boolean result = mapELResolver.isReadOnly(context, map, new Object()); Assert.assertTrue(result); @@ -242,8 +238,7 @@ public class TestMapELResolver { @Test public void testGetFeatureDescriptors01() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); Iterator<FeatureDescriptor> result = mapELResolver .getFeatureDescriptors(context, new Object()); @@ -257,10 +252,9 @@ public class TestMapELResolver { @Test public void testGetFeatureDescriptors02() { MapELResolver mapELResolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); - Map<String, String> map = new HashMap<>(); + Map<String, String> map = new HashMap<String, String>(); map.put("key", "value"); Iterator<FeatureDescriptor> result = mapELResolver .getFeatureDescriptors(context, map); @@ -283,8 +277,7 @@ public class TestMapELResolver { private void doNegativeTest(Object base, Object trigger, MethodUnderTest method, boolean checkResult) { MapELResolver resolver = new MapELResolver(); - ELContext context = new StandardELContext( - ELManager.getExpressionFactory()); + ELContext context = new ELContextImpl(); Object result = null; switch (method) { Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1501478&r1=1501477&r2=1501478&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Tue Jul 9 19:25:22 2013 @@ -82,6 +82,13 @@ throw <code>NullPointerException</code> when the provided class is null. (violetagg) </fix> + <fix> + Ensure that <code>FeatureDescriptor</code> objects returned by + <code>javax.el.MapELResolver.getFeatureDescriptors(ELContext,Object)</code> + will be created with a correct <code>shortDescription</code> - an empty string and + a named attribute <code>ELResolver.RESOLVABLE_AT_DESIGN_TIME</code> - + true. (violetagg) + </fix> </changelog> </subsection> <subsection name="Cluster"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org