You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/07/04 20:43:50 UTC

[tomcat] branch master updated (aced7b8 -> 1724246)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from aced7b8  Add multiple SCIs
     new 7d8379e  Increment version for next dev cycle
     new 1724246  Expand code coverage for ArrayELResolver

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.properties.default               |   2 +-
 res/maven/mvn.properties.default       |   2 +-
 test/javax/el/TestArrayELResolver.java | 170 ++++++++++++++++++++++++++++++++-
 webapps/docs/changelog.xml             |   4 +-
 4 files changed, 171 insertions(+), 7 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/02: Increment version for next dev cycle

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 7d8379ec7f32e29f1f255052396876c09e62465a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jul 4 20:35:07 2019 +0100

    Increment version for next dev cycle
---
 build.properties.default         | 2 +-
 res/maven/mvn.properties.default | 2 +-
 webapps/docs/changelog.xml       | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 230d8c4..290d603 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -25,7 +25,7 @@
 # ----- Version Control Flags -----
 version.major=9
 version.minor=0
-version.build=22
+version.build=23
 version.patch=0
 version.suffix=-dev
 
diff --git a/res/maven/mvn.properties.default b/res/maven/mvn.properties.default
index 3da7dfb..29f0d5b 100644
--- a/res/maven/mvn.properties.default
+++ b/res/maven/mvn.properties.default
@@ -39,7 +39,7 @@ maven.asf.release.repo.url=https://repository.apache.org/service/local/staging/d
 maven.asf.release.repo.repositoryId=apache.releases.https
 
 # Release version info
-maven.asf.release.deploy.version=9.0.22
+maven.asf.release.deploy.version=9.0.23
 
 #Where do we load the libraries from
 tomcat.lib.path=../../output/build/lib
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b33ad6e..7adb842 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -44,7 +44,9 @@
   They eventually become mixed with the numbered issues (i.e., numbered
   issues do not "pop up" wrt. others).
 -->
-<section name="Tomcat 9.0.22 (markt)" rtext="in development">
+<section name="Tomcat 9.0.23 (markt)" rtext="in development">
+</section>
+<section name="Tomcat 9.0.22 (markt)" rtext="release in progress">
   <subsection name="Catalina">
     <changelog>
       <fix>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/02: Expand code coverage for ArrayELResolver

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 17242464af539a92e347aff726c3f95f290e71c1
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jul 4 21:42:59 2019 +0100

    Expand code coverage for ArrayELResolver
---
 test/javax/el/TestArrayELResolver.java | 170 ++++++++++++++++++++++++++++++++-
 1 file changed, 166 insertions(+), 4 deletions(-)

diff --git a/test/javax/el/TestArrayELResolver.java b/test/javax/el/TestArrayELResolver.java
index cea9b97..1280fb1 100644
--- a/test/javax/el/TestArrayELResolver.java
+++ b/test/javax/el/TestArrayELResolver.java
@@ -85,6 +85,21 @@ public class TestArrayELResolver {
     }
 
     /**
+     * Tests that a null result is returned when the base is null.
+     */
+    @Test
+    public void testGetType06() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        Class<?> result = resolver.getType(context, null, "index");
+
+        Assert.assertNull(result);
+        Assert.assertFalse(context.isPropertyResolved());
+    }
+
+    /**
      * Tests that a null context results in an NPE as per EL Javadoc.
      */
     @Test(expected = NullPointerException.class)
@@ -118,11 +133,83 @@ public class TestArrayELResolver {
         Assert.assertTrue(context.isPropertyResolved());
     }
 
+    @Test
+    public void testGetValueCoercion01() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        String[] base = new String[] { "element" };
+        Object result = resolver.getValue(context, base, Character.valueOf((char) 0));
+
+        Assert.assertEquals("element", result);
+        Assert.assertTrue(context.isPropertyResolved());
+    }
+
+    @Test
+    public void testGetValueCoercion02a() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        String[] base = new String[] { "element" };
+        Object result = resolver.getValue(context, base, Boolean.FALSE);
+
+        Assert.assertEquals("element", result);
+        Assert.assertTrue(context.isPropertyResolved());
+    }
+
+    @Test
+    public void testGetValueCoercion02b() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        String[] base = new String[] { "element" };
+        Object result = resolver.getValue(context, base, Boolean.TRUE);
+
+        Assert.assertNull(result);
+        Assert.assertTrue(context.isPropertyResolved());
+    }
+
+    @Test
+    public void testGetValueCoercion03() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        String[] base = new String[] { "element" };
+        Object result = resolver.getValue(context, base, "0");
+
+        Assert.assertEquals("element", result);
+        Assert.assertTrue(context.isPropertyResolved());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testGetValueCoercion04() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        String[] base = new String[] { "element" };
+        resolver.getValue(context, base, new Object());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testGetValueCoercion05() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        String[] base = new String[] { "element" };
+        resolver.getValue(context, base, null);
+    }
+
     /**
      * Tests a coercion cannot be performed as the key is not integer.
      */
     @Test(expected = IllegalArgumentException.class)
-    public void testGetValue04() {
+    public void testGetValueCoercion06() {
         ArrayELResolver resolver = new ArrayELResolver();
         ELContext context = new StandardELContext(
                 ELManager.getExpressionFactory());
@@ -132,7 +219,7 @@ public class TestArrayELResolver {
     }
 
     /**
-     * Tests that the key is out of bounds and null will be returned.
+     * Tests that if the key is out of bounds null will be returned.
      */
     @Test
     public void testGetValue05() {
@@ -261,6 +348,19 @@ public class TestArrayELResolver {
         Assert.assertEquals(Integer.valueOf(base[1]), Integer.valueOf(4));
     }
 
+    /*
+     * Null base should be a NO-OP rather than an exception
+     */
+    @Test
+    public void testSetValue09() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        resolver.setValue(context, null, Integer.valueOf(1), Integer.valueOf(4));
+        Assert.assertFalse(context.isPropertyResolved());
+    }
+
     /**
      * Tests that a null context results in an NPE as per EL Javadoc.
      */
@@ -322,19 +422,29 @@ public class TestArrayELResolver {
      */
     @Test(expected = PropertyNotFoundException.class)
     public void testIsReadOnly04() {
+        doTestIsReadOutOfBounds(1);
+    }
+
+    @Test(expected = PropertyNotFoundException.class)
+    public void testIsReadOnly05() {
+        doTestIsReadOutOfBounds(-1);
+    }
+
+    private void doTestIsReadOutOfBounds(int index) {
         ArrayELResolver resolver = new ArrayELResolver();
         ELContext context = new StandardELContext(
                 ELManager.getExpressionFactory());
 
         String[] base = new String[] { "element" };
-        resolver.isReadOnly(context, base, Integer.valueOf(1));
+        resolver.isReadOnly(context, base, Integer.valueOf(index));
+        Assert.assertTrue(context.isPropertyResolved());
     }
 
     /**
      * Tests that a result is returned even when a coercion cannot be performed.
      */
     @Test
-    public void testIsReadOnly05() {
+    public void testIsReadOnly06() {
         ArrayELResolver resolver = new ArrayELResolver();
         ELContext context = new StandardELContext(
                 ELManager.getExpressionFactory());
@@ -353,6 +463,25 @@ public class TestArrayELResolver {
         Assert.assertTrue(context.isPropertyResolved());
     }
 
+    @Test
+    public void testIsReadOnly07() {
+        ArrayELResolver resolver = new ArrayELResolver();
+        ELContext context = new StandardELContext(
+                ELManager.getExpressionFactory());
+
+        boolean result = resolver.isReadOnly(context, null, null);
+
+        Assert.assertFalse(result);
+        Assert.assertFalse(context.isPropertyResolved());
+
+        resolver = new ArrayELResolver(true);
+
+        result = resolver.isReadOnly(context, null, null);
+
+        Assert.assertTrue(result);
+        Assert.assertFalse(context.isPropertyResolved());
+    }
+
     private void doNegativeTest(Object base, Object trigger,
             MethodUnderTest method, boolean checkResult) {
         ArrayELResolver resolver = new ArrayELResolver();
@@ -389,4 +518,37 @@ public class TestArrayELResolver {
         GET_VALUE, SET_VALUE, GET_TYPE
     }
 
+
+    @Test
+    public void testGetFeatureDescriptiors() {
+        // Should always return null
+        ArrayELResolver resolver = new ArrayELResolver();
+        Assert.assertNull(resolver.getFeatureDescriptors(null, null));
+    }
+
+
+    @Test
+    public void testGetCommonPropertyType01() {
+        // null base, null response
+        ArrayELResolver resolver = new ArrayELResolver();
+        Assert.assertNull(resolver.getCommonPropertyType(null, null));
+    }
+
+
+    @Test
+    public void testGetCommonPropertyType02() {
+        // non-array base, null response
+        ArrayELResolver resolver = new ArrayELResolver();
+        Assert.assertNull(resolver.getCommonPropertyType(null, new Object()));
+    }
+
+
+    @Test
+    public void testGetCommonPropertyType03() {
+        // array base, Integer response
+        ArrayELResolver resolver = new ArrayELResolver();
+        Class<?> clazz = resolver.getCommonPropertyType(null, new Object[]{});
+        Assert.assertNotNull(clazz);
+        Assert.assertEquals(clazz, Integer.class);
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org