Package org.auraframework.expression

Examples of org.auraframework.expression.PropertyReference


        bvp.validate(BrowserProperty.isIPad);
        bvp.validate(BrowserProperty.isIPhone);
        bvp.validate(BrowserProperty.isIOS);
        bvp.validate(BrowserProperty.isWindowsPhone);

        PropertyReference property = new PropertyReferenceImpl("hah", null);
        try {
            bvp.validate(property);
            fail("Expected InvalidExpressionException for " + property);
        } catch (InvalidExpressionException e) {
            assertEquals("No property on $Browser for key: " + property,
View Full Code Here


        LocaleValueProvider lvp = new LocaleValueProvider();
        for (LocaleProperty lp : LocaleProperty.values()) {
            lvp.validate(lp.getRef());
        }

        PropertyReference property = new PropertyReferenceImpl("badProperty", null);
        try {
            lvp.validate(property);
            fail("Expected InvalidExpressionException for " + property);
        } catch (InvalidExpressionException e) {
            assertEquals("No property on $Locale for key: " + property,
View Full Code Here

     * Property references can have multiple parts.
     */
    public void testPropertyReference() throws Exception {
        Expression e = buildExpression("im");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        PropertyReference pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.parsing");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReferenceImpl) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "parsing", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.not.nullish");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReferenceImpl) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "not", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming twice", "nullish", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("_i.am_very._.readable_");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReferenceImpl) e;
        assertEquals("Unexpected root of PropertyReference", "_i", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "am_very", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming twice", "_", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming thrice", "readable_", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());
    }
View Full Code Here

     * Property references can access array members
     */
    public void testArrayAccessors() throws Exception {
        Expression e = buildExpression("im[0]");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        PropertyReference pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference", "0", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.an[3151345]");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("im.an[3151345].array");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "im", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming", "an", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference after stemming", "3151345", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unexpected root of PropertyReference after stemming and accessing array", "array", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());

        e = buildExpression("multi[1][364]");
        assertEquals("Unexpected expression type", ExpressionType.PROPERTY, e.getExpressionType());
        pr = (PropertyReference) e;
        assertEquals("Unexpected root of PropertyReference", "multi", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access array member via PropertyReference", "1", pr.getRoot());
        pr = pr.getStem();
        assertEquals("Unable to access second array member via PropertyReference", "364", pr.getRoot());
        assertNull("Stemming end of PropertyReference should return null", pr.getStem());
    }
View Full Code Here

TOP

Related Classes of org.auraframework.expression.PropertyReference

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.