Package org.auraframework.def

Examples of org.auraframework.def.ApplicationDef


    public void testDefinitionsFetchingInTestMode() throws Exception {
        Aura.getContextService().endContext();
        Aura.getContextService().startContext(Mode.PROD, null, Format.JSON, Authentication.AUTHENTICATED);
       
        // Obtain the definition of an application without layout and make sure the layoutsDefDescriptor is null
        ApplicationDef appWithNoLayout = addSourceAutoCleanup(ApplicationDef.class,
                "<aura:application access=\"public\"></aura:application>").getDef();
        DefDescriptor<ApplicationDef> appDesc = appWithNoLayout.getDescriptor();
        assertNotNull("Test failed to retrieve definition of an application.", appWithNoLayout);
        assertNull("Application should not have had any layouts associted with it.",
                appWithNoLayout.getLayoutsDefDescriptor());

        // Add a new layouts file to the application.
        DefDescriptor<LayoutsDef> layoutDesc = DefDescriptorImpl.getInstance(appDesc.getDescriptorName(),
                LayoutsDef.class);
        String layoutData = "<aura:layouts catchall='home' default='home'>" + "<aura:layout name='home' title='Home'>"
                + "<aura:layoutItem container='content'>" + "Home" + "</aura:layoutItem>" + "</aura:layout>"
                + "</aura:layouts>";
        addSourceAutoCleanup(layoutDesc, layoutData);

        // We are still fetching definition in PROD mode, so it should fetch the definition from cache. So no layout def
        // yet.
        appWithNoLayout = definitionService.getDefinition(appDesc);
        assertNotNull("Test failed to retrieve definition of an application.", appWithNoLayout);
        assertNull("In PROD mode, new layout file should not have been fetched.",
                appWithNoLayout.getLayoutsDefDescriptor());

        Aura.getContextService().endContext();
        // Fetch definition in TEST mode
        Aura.getContextService().startContext(Mode.UTEST, null, Format.JSON, Authentication.AUTHENTICATED);
        appWithNoLayout = definitionService.getDefinition(appDesc);
        DefDescriptor<LayoutsDef> layoutDefDesc = appWithNoLayout.getLayoutsDefDescriptor();
        assertNotNull("Test failed to retrieve definition of an application.", appWithNoLayout);
        assertNotNull("Fetching definition is TEST mode should have noticed the new layout file.", layoutDefDesc);
        assertNotNull("Failed to read definition from new layout file.", layoutDefDesc.getDef());
    }
View Full Code Here


     * layouts file in the component folder.
     *
     * @throws Exception
     */
    public void testLayoutsFromApplicationDefAutoWire() throws Exception {
        ApplicationDef applicationDef = Aura.getDefinitionService().getDefinition("test:layouts", ApplicationDef.class);
        validateLayouts(applicationDef.getLayoutsDefDescriptor().getDef());
    }
View Full Code Here

     * Test to verify Layouts on Application def. Explicit specification of layouts file.
     *
     * @throws Exception
     */
    public void testLayoutsFromApplicationDefAttribute() throws Exception {
        ApplicationDef applicationDef = Aura.getDefinitionService()
                .getDefinition("test:layouts2", ApplicationDef.class);
        validateLayouts(applicationDef.getLayoutsDefDescriptor().getDef());
    }
View Full Code Here

        DefDescriptor<ApplicationDef> appDesc = Aura.getDefinitionService().getDefDescriptor(
                "preloadTest:dependenciesApp", ApplicationDef.class);
        AuraContext context = Aura.getContextService().startContext(Mode.UTEST, Format.HTML,
                Authentication.AUTHENTICATED, appDesc);
        DefinitionService ds = Aura.getDefinitionService();
        ApplicationDef appDef = ds.getDefinition("preloadTest:dependenciesApp", ApplicationDef.class);
        Map<DefDescriptor<?>, String> clientLoaded = Maps.newHashMap();
        clientLoaded.put(appDesc, context.getDefRegistry().getUid(null, appDesc));
        context.setClientLoaded(clientLoaded);
        ds.updateLoaded(null);
View Full Code Here

                sw.write('\n');
            }

            // Add in any application specific resources
            if (descr != null && descr.getDefType().equals(DefType.APPLICATION)) {
                ApplicationDef def = (ApplicationDef) descr.getDef();
                for (String s : def.getAdditionalAppCacheURLs()) {
                    sw.write(s);
                    sw.write('\n');
                }
            }
View Full Code Here

TOP

Related Classes of org.auraframework.def.ApplicationDef

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.