Package org.apache.jasper.el

Examples of org.apache.jasper.el.ELContextImpl


     */
    public void testSetValue05() {
        Exception expected = null;
        try {
            ArrayELResolver resolver = new ArrayELResolver();
            ELContext context = new ELContextImpl();

            String[] base = new String[] { "element" };
            resolver.setValue(context, base, "key", "new-element");
        } catch (Exception e) {
            expected = e;
View Full Code Here


     */
    public void testSetValue06() {
        Exception expected = null;
        try {
            ArrayELResolver resolver = new ArrayELResolver();
            ELContext context = new ELContextImpl();

            String[] base = new String[] { "element" };
            resolver.setValue(context, base, new Integer(1), "new-element");
        } catch (Exception e) {
            expected = e;
View Full Code Here

     */
    public void testSetValue07() {
        Exception expected = null;
        try {
            ArrayELResolver resolver = new ArrayELResolver();
            ELContext context = new ELContextImpl();

            String[] base = new String[] { "element" };
            resolver.setValue(context, base, new Integer(0), new Integer(1));
        } catch (Exception e) {
            expected = e;
View Full Code Here

     * Tests setting arrays of primitives.
     * https://issues.apache.org/bugzilla/show_bug.cgi?id=55691
     */
    public void testSetValue08() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        int[] base = new int[] { 1, 2, 3 };
        resolver.setValue(context, base, new Integer(1), Integer.valueOf(4));

        Assert.assertEquals(Integer.valueOf(base[1]), Integer.valueOf(4));
View Full Code Here

    /**
     * Tests that the propertyResolved is false if base is not an array.
     */
    public void testIsReadOnly02() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        boolean result = resolver.isReadOnly(context, new Object(),
                new Object());

        Assert.assertFalse(result);
        Assert.assertFalse(context.isPropertyResolved());

        resolver = new ArrayELResolver(true);

        result = resolver.isReadOnly(context, new Object(), new Object());

        Assert.assertTrue(result);
        Assert.assertFalse(context.isPropertyResolved());
    }
View Full Code Here

     * Tests that if the ArrayELResolver is constructed with readOnly the method
     * will return always true, otherwise false.
     */
    public void testIsReadOnly03() {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        String[] base = new String[] { "element" };
        boolean result = resolver.isReadOnly(context, base, new Integer(0));

        Assert.assertFalse(result);
        Assert.assertTrue(context.isPropertyResolved());

        resolver = new ArrayELResolver(true);

        result = resolver.isReadOnly(context, base, new Integer(0));

        Assert.assertTrue(result);
        Assert.assertTrue(context.isPropertyResolved());
    }
View Full Code Here

     */
    public void testIsReadOnly04() {
        Exception expected = null;
        try {
            ArrayELResolver resolver = new ArrayELResolver();
            ELContext context = new ELContextImpl();

            String[] base = new String[] { "element" };
            resolver.isReadOnly(context, base, new Integer(1));
        } catch (Exception e) {
            expected = e;
View Full Code Here

    }

    private void doNegativeTest(Object base, Object trigger,
            MethodUnderTest method, boolean checkResult) {
        ArrayELResolver resolver = new ArrayELResolver();
        ELContext context = new ELContextImpl();

        Object result = null;
        switch (method) {
        case GET_VALUE: {
            result = resolver.getValue(context, base, trigger);
            break;
        }
        case SET_VALUE: {
            resolver.setValue(context, base, trigger, new Object());
            break;
        }
        case GET_TYPE: {
            result = resolver.getType(context, base, trigger);
            break;
        }
        default: {
            // Should never happen
            Assert.fail("Missing case for method");
        }
        }

        if (checkResult) {
            Assert.assertNull(result);
        }
        Assert.assertFalse(context.isPropertyResolved());
    }
View Full Code Here

                                        validateFunctions(el, n);
                                        jspAttrs[i] = new Node.JspAttribute(tldAttr,
                                                attrs.getQName(i), attrs.getURI(i),
                                                attrs.getLocalName(i),
                                                attrs.getValue(i), false, el, false);
                                        ELContextImpl ctx = new ELContextImpl();
                                        ctx.setFunctionMapper(getFunctionMapper(el));
                                        try {
                                            jspAttrs[i].validateEL(this.pageInfo.getExpressionFactory(), ctx);
                                        } catch (ELException e) {
                                            this.err.jspError(n.getStart(),
                                                    "jsp.error.invalid.expression",
View Full Code Here

                        } else {
                            result = new Node.JspAttribute(tai, qName, uri,
                                    localName, value, false, el, dynamic);
                        }

                        ELContextImpl ctx = new ELContextImpl();
                        ctx.setFunctionMapper(getFunctionMapper(el));

                        try {
                            result.validateEL(this.pageInfo
                                    .getExpressionFactory(), ctx);
                        } catch (ELException e) {
View Full Code Here

TOP

Related Classes of org.apache.jasper.el.ELContextImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.