Package org.auraframework.instance

Examples of org.auraframework.instance.Model


     */
    // TODO: W-1478576 Must consolidate such methods in a util.
    protected Model getJavaModelByQualifiedName(String qualifiedName) throws Exception {
        ModelDef javaModelDef = definitionService.getDefinition(qualifiedName, ModelDef.class);
        assertTrue(javaModelDef instanceof JavaModelDefImpl);
        Model model = javaModelDef.newInstance();
        assertNotNull("Failed to retrieve model instance of " + qualifiedName, model);
        return model;
    }
View Full Code Here


    public TypeAnnotationInModelTest(String name) {
        super(name);
    }

    public void testValidTypeAnnotationInJavaModel() throws Exception {
        Model model = getJavaModelByQualifiedName("java://org.auraframework.impl.java.model.TestModelWithJavaTypeAnnotation");
        // Verify model values for basic data types
        assertBasicDataTypes(model);
        // Any java type which implements the Serializable interface can be
        // specified as return type.
        assertEachModelMember(model, "javaString", "Java");
View Full Code Here

        // TODO W-990851, Verify model values for collections and map data types
        // assertCollectionAndMapDataTypes(model);
    }

    public void testValidAuraTypeAnnotationInJavaModel() throws Exception {
        Model model = getJavaModelByQualifiedName("java://org.auraframework.impl.java.model.TestModelWithAuraTypeAnnotation");
        // Verify model values for basic data types
        assertBasicDataTypes(model);

        // TODO:W-967767, Should be able to specify array as return type
        // assertEachModelMember(model, "stringArray", new String[]{"one",
View Full Code Here

        // Verify model values for collections and map data types
        assertCollectionAndMapDataTypes(model);
    }

    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

         */

    }

    public void testCaseSensitivityOfTypeAnnotationInJavaModel() throws Exception {
        Model model = getJavaModelByQualifiedName("java://org.auraframework.impl.java.model.TestModelWithCaseInsensitiveTypeAnnotation");
        assertEachModelMember(model, "string", "Model");
        assertEachModelMember(model, "double", 1.23);
    }
View Full Code Here

    }

    public void testSerializeData() throws Exception {
        JavaModelDefFactory factory = new JavaModelDefFactory(null);
        ModelDef def = factory.getDef(descriptor);
        Model model = def.newInstance();
        serializeAndGoldFile(model);
    }
View Full Code Here

    public void testModelSubclass() throws Exception {
        DefDescriptor<ModelDef> javaModelDefDesc = DefDescriptorImpl.getInstance(
                "java://org.auraframework.impl.java.model.TestModelSubclass", ModelDef.class);
        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

    public void testNonExistingPropertiesOnModel() throws Exception {
        DefDescriptor<ModelDef> javaModelDefDesc = DefDescriptorImpl.getInstance(
                "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

        Object defaultValue = valueDef.getDefaultValue();
        assertEquals(expectedValue, defaultValue);

        // Also validate that the default appropriately shows up on an instance
        // of this model.
        Model model = def.newInstance();
        Object instanceValue = model.getValue(new PropertyReferenceImpl(name, null));
        assertEquals(expectedValue, instanceValue);

        // Make sure that the instance value was cloned so that changes to the
        // instance value don't affect other instances or the default.
        // This check doesn't work well for booleans or Strings.
View Full Code Here

TOP

Related Classes of org.auraframework.instance.Model

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.