Package org.auraframework.def

Examples of org.auraframework.def.ModelDef


    }

    @Override
    protected ModelDef createDefinition(Map<String, Object> map)
            throws QuickFixException {
        ModelDef baseDef = getBaseDefinition((String) map.get("descriptor"), ModelDef.class);
        modelDefDescriptor = baseDef.getDescriptor();

        List<Stub<?>> stubs = getStubs(map.get("stubs"));

        return (ModelDef) Proxy.newProxyInstance(this.getClass().getClassLoader(),
                new Class<?>[] { ModelDef.class, Resettable.class }, new DelegatingStubHandler(baseDef, stubs));
View Full Code Here


    private void createModel() throws QuickFixException {
        AuraContext context = Aura.getContextService().getCurrentContext();
        context.pushCallingDescriptor(descriptor);
        BaseComponent<?, ?> oldComponent = context.setCurrentComponent(this);
        try {
            ModelDef modelDef = getComponentDef().getModelDef();
            if (modelDef != null) {
                Aura.getDefinitionService().getDefRegistry().assertAccess(descriptor, modelDef);

                model = modelDef.newInstance();
                if (modelDef.hasMembers()) {
                    hasLocalDependencies = true;
                    valueProviders.put(ValueProviderType.MODEL.getPrefix(), model);
                }
            }
        } finally {
View Full Code Here

        assertEquals("JavaTestController", cds.get(0).getName());

        DefDescriptor<ModelDef> lmdd = component.getLocalModelDefDescriptor();
        assertEquals("TestJavaModel", lmdd.getName());

        ModelDef model = component.getModelDef();
        assertEquals("TestJavaModel", model.getName());

        ControllerDef controller = component.getControllerDef();
        assertEquals("testComponent1", controller.getName());

        DefDescriptor<RendererDef> rd = component.getRendererDescriptor();
View Full Code Here

        assertEquals("JavaTestController", cds.get(0).getName());

        DefDescriptor<ModelDef> lmdd = application.getLocalModelDefDescriptor();
        assertEquals("TestJavaModel", lmdd.getName());

        ModelDef model = application.getModelDef();
        assertEquals("TestJavaModel", model.getName());

        ControllerDef controller = application.getControllerDef();
        assertEquals("testApplication1", controller.getName());

        DefDescriptor<RendererDef> rd = application.getRendererDescriptor();
View Full Code Here

                        "{!m.string}<aura:iteration items='{!m.stringList}' var='i'>{!i}</aura:iteration>"));

        // If we want to "chain" mocks (where it may be instantiated multiple times in a single request), Mockito
        // let us do it, but we don't have a convenience function for that because it shouldn't be a common case (in
        // tests)
        ModelDef modelDef = Mockito.spy(Aura.getDefinitionService().getDefinition(modelDefDescriptor));
        mockingUtil.mockDef(modelDef);

        // chain 2 different string values followed by an exception
        MockModel model1 = new MockModel(modelDefDescriptor, ImmutableMap.of("string", (Object) "age"));
        MockModel model2 = new MockModel(modelDefDescriptor, ImmutableMap.of("string", (Object) "beauty"));
View Full Code Here

     * @return the MockModel that will be provided when instantiating the requested ModelDef
     * @throws Exception
     */
    public MockModel mockModel(DefDescriptor<ModelDef> modelDefDescriptor, Map<String, Object> properties)
            throws Exception {
        final ModelDef modelDef = Mockito.spy(Aura.getDefinitionService().getDefinition(modelDefDescriptor));
        final MockModel model = Mockito.spy(new MockModel(modelDefDescriptor, properties));
        Mockito.doReturn(model).when(modelDef).newInstance();
        mockDef(modelDef);
        return model;
    }
View Full Code Here

     * @return
     * @throws Exception
     */
    // 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

        super(name);
    }

    public void testSerializeMetadata() throws Exception {
        JavaModelDefFactory factory = new JavaModelDefFactory();
        ModelDef def = factory.getDef(descriptor);
        serializeAndGoldFile(def);
    }
View Full Code Here

        serializeAndGoldFile(def);
    }

    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

     * Test subclassing.
     */
    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

TOP

Related Classes of org.auraframework.def.ModelDef

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.