Package org.auraframework.impl.expression

Examples of org.auraframework.impl.expression.PropertyReferenceImpl


    }

    public void testInvalidLiteralTypeAnnotationInJavaModel() throws Exception {
        Model model = getJavaModelByQualifiedName("java://org.auraframework.impl.java.model.TestModelWithLiteralTypeAnnotation");
        try {
            model.getValue(new PropertyReferenceImpl("string", null));
            fail("Failed to catch invalid type specified for member method in model.");
        } catch (AuraRuntimeException expected) {
        }

    }
View Full Code Here


    }

    public void testAuraComponentTypeAnnotationInJavaModel() throws Exception {
        Model model = getJavaModelByQualifiedName("java://org.auraframework.impl.java.model.TestModelWithAuraTypeAnnotation");
        Object value = model.getValue(new PropertyReferenceImpl("auraComponent", null));
        assertTrue(value instanceof Component);
        assertEquals("markup://test:text", ((Component) value).getDescriptor().getQualifiedName());

        /**
         * TODO:W-967767
 
View Full Code Here

        ss6.add(s6);
        assertEachModelMember(model, "setOfSet", ss6);
    }

    private void assertEachModelMember(Model model, String memberName, Object expectedResult) throws Exception {
        Object value = model.getValue(new PropertyReferenceImpl(memberName, null));
        assertEquals("Expected model method to return " + expectedResult.getClass() + " type object.",
                expectedResult.getClass(), value.getClass());
        assertEquals("Model returned unexpected object.", expectedResult, value);
    }
View Full Code Here

        Mockito.doReturn(GLOBAL_ACCESS).when(parentDef).getAccess();
        Mockito.doReturn(parentDef).when(this.extendsDescriptor).getDef();
        Mockito.doReturn(DefType.COMPONENT).when(this.extendsDescriptor).getDefType();
       
        this.expressionRefs = Sets.newHashSet();
        this.expressionRefs.add(new PropertyReferenceImpl("v.privateAttribute", null));
        this.attributeDefs = ImmutableMap.of(attrDesc, attrDef);

        buildDefinition().validateReferences();
    }
View Full Code Here

        Mockito.doReturn(GLOBAL_ACCESS).when(parentDef).getAccess();
        Mockito.doReturn(DefType.COMPONENT).when(this.extendsDescriptor).getDefType();

        Location exprLocation = new Location("expression", 0);
        this.expressionRefs = Sets.newHashSet();
        this.expressionRefs.add(new PropertyReferenceImpl("v.privateAttribute", exprLocation));
        this.attributeDefs = ImmutableMap.of();

        try {
            buildDefinition().validateReferences();
            fail("Expected an exception when trying to refer to a private attribute in an expression");
View Full Code Here

        Mockito.doReturn(parentDef).when(this.extendsDescriptor).getDef();
        Mockito.doReturn(GLOBAL_ACCESS).when(parentDef).getAccess();
        Mockito.doReturn(DefType.COMPONENT).when(this.extendsDescriptor).getDefType();

        this.expressionRefs = Sets.newHashSet();
        this.expressionRefs.add(new PropertyReferenceImpl("v.privateAttribute", null));
        this.attributeDefs = ImmutableMap.of(attrDesc, attrDef);

        buildDefinition().validateReferences();
    }
View Full Code Here

        ModelDef def = javaModelDefDesc.getDef();
        assertNotNull(def);
        Model model = def.newInstance();
        ValueDef vd = def.getMemberByName("nextThing");

        PropertyReferenceImpl refNextThing = new PropertyReferenceImpl("nextThing", new Location("test", 0));
        assertNotNull("Unable to find value def for 'nextThing'", vd);
        assertEquals("nextThing", model.getValue(refNextThing));

        vd = def.getMemberByName("firstThing");
        PropertyReferenceImpl refFirstThing = new PropertyReferenceImpl("firstThing", new Location("test", 1));
        assertNotNull("Unable to find value def for 'firstThing'", vd);
        assertEquals("firstThingDefault", model.getValue(refFirstThing));
    }
View Full Code Here

                "java://org.auraframework.impl.java.model.TestModel", ModelDef.class);
        ModelDef mDef = javaModelDefDesc.getDef();
        assertNotNull(mDef);
        Model model = mDef.newInstance();
        try {
            model.getValue(new PropertyReferenceImpl("fooBar", new Location("test", 0)));
            fail("Model should not be able to getValue of a non existing property.");
        } catch (Exception e) {
            checkExceptionStart(e, AuraExecutionException.class, "TestModel: no such property: fooBar",
                    javaModelDefDesc.getName());
        }
        try {
            model.getValue(new PropertyReferenceImpl("firstThi", new Location("test", 0)));
            fail("Model.getValue() on partial matches of property names should not be successful.");
        } catch (Exception e) {
            checkExceptionStart(e, AuraExecutionException.class, "TestModel: no such property: firstThi",
                    javaModelDefDesc.getName());
        }
View Full Code Here

    }
   
    public void testReinitializeModel() throws Exception {
        Component cmp = vendor.makeComponent("test:child1", "meh");

        PropertyReferenceImpl propRef = new PropertyReferenceImpl("value", null);
    assertEquals(null, cmp.getModel().getValue(propRef));
       
        setAttribute(cmp, "attr", "some value");

    assertEquals(null, cmp.getModel().getValue(propRef));
View Full Code Here

                String.format(baseComponentTag, "extensible='true'",
                        "<aura:attribute name='parentAttr1' type='String' default='mother'/>"
                                + "<aura:attribute name='parentAttr2' type='String' default='father'/>"
                                + "<aura:attribute name='relativeAttr' type='String' default='aunt'/>"));
        Component parentCmp = Aura.getInstanceService().getInstance(parentDesc);
        assertEquals("mother", parentCmp.getValue(new PropertyReferenceImpl("v.parentAttr1", AuraUtil
                .getExternalLocation("direct attributeset access"))));
        assertEquals("mother", parentCmp.getValue(new PropertyReferenceImpl("v.PARENTATTR1", AuraUtil
                .getExternalLocation("direct attributeset access"))));

        // 2. Attributes inherited through parent
        DefDescriptor<ComponentDef> childDesc = addSourceAutoCleanup(ComponentDef.class, String.format(
                baseComponentTag, String.format("extends='%s'", parentDesc.getDescriptorName()),
                "<aura:set attribute='parentAttr2' value='godFather'/>"));
        Component childCmp = Aura.getInstanceService().getInstance(childDesc);
        assertEquals("mother", childCmp.getValue(new PropertyReferenceImpl("v.parentAttr1", AuraUtil
                .getExternalLocation("direct attributeset access"))));
        assertEquals("mother", childCmp.getValue(new PropertyReferenceImpl("v.PARENTAttr1", AuraUtil
                .getExternalLocation("direct attributeset access"))));
        assertEquals(
                "mother",
                childCmp.getSuper().getValue(
                        new PropertyReferenceImpl("v.pARENTAttr1", AuraUtil
                                .getExternalLocation("direct attributeset access"))));
        // Override default value will not change the value on the child
        assertEquals("father", childCmp.getValue(new PropertyReferenceImpl("v.PARENTAttr2", AuraUtil
                .getExternalLocation("direct attributeset access"))));
        // Override default value will not change the value on the parent,
        // <aura:set> sets the
        // value of the parent
        assertEquals(
                "godFather",
                childCmp.getSuper().getValue(
                        new PropertyReferenceImpl("v.PARENTAttr2", AuraUtil
                                .getExternalLocation("direct attributeset access"))));
    }
View Full Code Here

TOP

Related Classes of org.auraframework.impl.expression.PropertyReferenceImpl

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.