Package org.auraframework.service

Examples of org.auraframework.service.ContextService


    // TODO(W-1589052): UnAdaptable since breaks when trying to write/delete files from jars
    @UnAdaptableTest
    @ThreadHostileTest("changes test namespace")
    public void testSourceChangeClearsCachesInDevMode() throws Exception {
        // Make sure we're in Dev mode.
        ContextService contextService = Aura.getContextService();
        if (contextService.isEstablished()) {
            contextService.endContext();
        }
        contextService.startContext(Mode.DEV, Format.JSON, Authentication.AUTHENTICATED);

        MasterDefRegistryImpl mdr = getDefRegistry(false);
        DefDescriptor<ComponentDef> cmpDesc = Aura.getDefinitionService().getDefDescriptor("test:deleteMeAfterTest",
                ComponentDef.class);
View Full Code Here


            contextDepthCount -= 1;
        }
    }

    private AuraContext getContext(String num) throws ClientOutOfSyncException, QuickFixException {
        ContextService contextService = Aura.getContextService();

        if (contextService.isEstablished()) {
            contextDepthCount += 1;
        }

        DefDescriptor<ApplicationDef> applicationDescriptor = getApplicationDescriptor(application);

        AuraContext context;
        if (contextDepthCount == 0) {
            context = contextService.startContext(mode, Format.JSON, Authentication.AUTHENTICATED, applicationDescriptor);
        } else {
            context = contextService.getCurrentContext();
        }
        String cuid = context.getLoaded().get(applicationDescriptor);
        String uid = context.getDefRegistry().getUid(cuid, applicationDescriptor);
        context.addLoaded(applicationDescriptor, uid);
        context.setPreloadedDefinitions(context.getDefRegistry().getDependencies(uid));
View Full Code Here

        desc = ns2 + ":dummy";
        dummy = Aura.getDefinitionService().getDefDescriptor(desc, ComponentDef.class);
        addSourceAutoCleanup(dummy, "<aura:component></aura:component>");

        ContextService contextService = Aura.getContextService();
        if (contextService.isEstablished()) {
            contextService.endContext();
        }
        contextService.startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED);
    }
View Full Code Here

        String fmt = String.format("%s:%s", ns1, "testApp");
        DefDescriptor<ApplicationDef> appDesc = Aura.getDefinitionService().getDefDescriptor(fmt, ApplicationDef.class);
        addSourceAutoCleanup(appDesc, src.toString());

        // restart the context with the new app
        ContextService contextService = Aura.getContextService();
        if (contextService.isEstablished()) {
            contextService.endContext();
        }
        contextService.startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED, appDesc);
        return appDesc;
    }
View Full Code Here

    }

    @Override
    public void setUp() throws Exception {
        super.setUp();
        ContextService contextService = Aura.getContextService();
        AuraContext context = contextService.getCurrentContext();
        if (context == null) {
            contextService.startContext(AuraContext.Mode.SELENIUM, AuraContext.Format.HTML,
                    AuraContext.Authentication.AUTHENTICATED);
        }
        clientLibraryService = Aura.getClientLibraryService();
    }
View Full Code Here

        clientLibraryService = Aura.getClientLibraryService();
    }

    @Override
    public void tearDown() throws Exception {
        ContextService contextService = Aura.getContextService();
        AuraContext context = contextService.getCurrentContext();
        if (context != null) {
            contextService.endContext();
        }
        super.tearDown();
    }
View Full Code Here

                );
    }

    // provide a test component with TOKENs for replacement to trigger lastMod updates
    private ComponentDef getTargetComponent() throws Exception {
        ContextService service = Aura.getContextService();
        AuraContext context = service.getCurrentContext();
        if (context == null) {
            context = service.startContext(Mode.SELENIUM, Format.HTML, Authentication.AUTHENTICATED);
        }
        return Aura.getDefinitionService().getDefinition(
                String.format("%s:%s", namespace, cmpName), ComponentDef.class);
    }
View Full Code Here

    }

    // replaces TOKEN found in the source file with the provided replacement
    private void replaceToken(DefDescriptor<?> descriptor, String replacement) throws Exception {
        assertNotNull("Missing descriptor for source replacement!", descriptor);
        ContextService service = Aura.getContextService();
        AuraContext context = service.getCurrentContext();
        if (context == null) {
            context = service.startContext(Mode.SELENIUM, Format.HTML,
                    Authentication.AUTHENTICATED);
        }
        Source<?> source = context.getDefRegistry().getSource(descriptor);
        String originalContent = source.getContents();
        assert originalContent.contains(TOKEN);
View Full Code Here

    /**
     * Start a context and set up default values.
     */
    protected AuraContext setupContext(Mode mode, Format format, DefDescriptor<? extends BaseComponentDef> desc)
            throws QuickFixException {
        ContextService contextService = Aura.getContextService();
        AuraContext ctxt = contextService.startContext(mode, format, Authentication.AUTHENTICATED, desc);
        ctxt.setFrameworkUID(Aura.getConfigAdapter().getAuraFrameworkNonce());
        String uid = ctxt.getDefRegistry().getUid(null, desc);
        ctxt.addLoaded(desc, uid);
        return ctxt;
    }
View Full Code Here

    /**
     * Useful for restoring a context in case a test needs to temporarily switch contexts.
     */
    protected static void setContext(AuraContext context) {
        ContextService service = Aura.getContextService();
        AuraContext current = service.getCurrentContext();
        if (context == null || context == current) {
            return;
        }
        if (current != null) {
            service.endContext();
        }
        service.startContext(context.getMode(), context.getFormat(), context.getAccess(),
                context.getApplicationDescriptor());
    }
View Full Code Here

TOP

Related Classes of org.auraframework.service.ContextService

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.