Package org.auraframework.system

Examples of org.auraframework.system.AuraContext


        case APPLICATION:
            return (T) new ApplicationImpl((DefDescriptor<ApplicationDef>) descriptor, attributes);
        case COMPONENT:
            return (T) new ComponentImpl((DefDescriptor<ComponentDef>) descriptor, attributes);
        case ACTION:
            AuraContext context = Aura.getContextService().getCurrentContext();
            context.pushCallingDescriptor(descriptor);
            try {
                ControllerDef controllerDef = ((SubDefDescriptor<ActionDef, ControllerDef>) descriptor)
                        .getParentDescriptor().getDef();
                return (T) controllerDef.createAction(descriptor.getName(), attributes);
            } finally {
                context.popCallingDescriptor();
            }
        case EVENT:
            return (T) new EventImpl((DefDescriptor<EventDef>) descriptor, attributes);
        default:
            throw new AuraRuntimeException(String.format("Instances of %s cannot be created.", defType));
View Full Code Here


            return config;
        }

        List<BaseComponent<?, ?>> components = new ArrayList<BaseComponent<?, ?>>();
        List<?> list = (List<?>) config;
        AuraContext context = Aura.getContextService().getCurrentContext();

        if (list != null) {
            int idx = 0;
            for (Object defRef : list) {
                if (defRef instanceof BaseComponent) {
                    components.add((BaseComponent<?, ?>) defRef);
                } else if (defRef instanceof ComponentDefRef) {
                    context.getInstanceStack().setAttributeIndex(idx);
                    components.add(((ComponentDefRef) defRef).newInstance(valueProvider));
                    context.getInstanceStack().clearAttributeIndex(idx);
                    idx += 1;
                } else {
                    throw new InvalidDefinitionException(String.format("Expected Component, recieved %s", defRef
                            .getClass().getName()), getLocation());
                }
View Full Code Here

     * based on the Accept-Language header values when available, otherwise the
     * default is used.
     */
    @Override
    public AuraLocale getAuraLocale() {
        AuraContext context = Aura.getContextService().getCurrentContext();
        // check for nulls - this happens when AuraContextFilter has not been
        // run
        if (context != null) {
            List<Locale> locales = context.getRequestedLocales();
            if (locales != null && locales.size() > 0) {
                return new AuraLocaleImpl(locales.get(0));
            }
        }
        return new AuraLocaleImpl();
View Full Code Here

    }

    private void assertContextPath(AuraContextFilter filter, HttpServletRequest mock, String input, String expected)
            throws Exception {
        Mockito.when(mock.getContextPath()).thenReturn(input);
        AuraContext context = filter.startContext(mock, null, null);
        assertEquals(expected, context.getContextPath());
        filter.endContext();
    }
View Full Code Here

        super(name);
    }

    /** tests that the css url includes themes explicitly added to context */
    public void testCssUrlContextSpecifiedThemes() throws Exception {
        AuraContext ctx = setupContext();
        ctx.appendThemeDescriptor(DefDescriptorImpl.getInstance("test:fakeTheme", ThemeDef.class));
        ctx.appendThemeDescriptor(DefDescriptorImpl.getInstance("test:fakeTheme2", ThemeDef.class));
        ctx.appendThemeDescriptor(DefDescriptorImpl.getInstance("test:fakeTheme3", ThemeDef.class));
        goldFileAppCssUrl();
    }
View Full Code Here

    /**
     * tests that the css url includes themes from the app and also ones explicitly added to context. The app theme
     * should come first.
     */
    public void testCssUrlContextSpecifiedAndAppSpecifiedThemes() throws Exception {
        AuraContext ctx = setupContextWithAppReferencingThemes("test:fakeTheme3");
        ctx.appendThemeDescriptor(DefDescriptorImpl.getInstance("test:fakeTheme2", ThemeDef.class));
        goldFileAppCssUrl();
    }
View Full Code Here

    /** test that the css url includes a hash when a map-provided theme is used */
    public void testSerializeWithMapProvidedTheme() throws Exception {
        String name = "test:fakeThemeWithMapProvider";
        DefDescriptor<ThemeDef> theme = DefDescriptorImpl.getInstance(name, ThemeDef.class);
        AuraContext ctx = setupContextWithAppReferencingThemes(theme.getDescriptorName());
        ctx.appendThemeDescriptor(DefDescriptorImpl.getInstance("test:fakeTheme3", ThemeDef.class));
        goldFileAppCssUrl();
    }
View Full Code Here

    private AuraContext setupContext() {
        if (Aura.getContextService().isEstablished()) {
            Aura.getContextService().endContext();
        }

        AuraContext ctx = Aura.getContextService()
                .startContext(Mode.UTEST, Format.JSON, Authentication.UNAUTHENTICATED);
        return ctx;
    }
View Full Code Here

        if (Aura.getContextService().isEstablished()) {
            Aura.getContextService().endContext();
        }

        AuraContext ctx = Aura.getContextService()
                .startContext(Mode.UTEST, Format.JSON, Authentication.UNAUTHENTICATED, app);
        return ctx;
    }
View Full Code Here

        // make human readable
        url = AuraTextUtil.urldecode(url);

        // replace app descriptor, which is generated
        AuraContext ctx = Aura.getContextService().getCurrentContext();
        DefDescriptor<? extends BaseComponentDef> desc = ctx.getLoadingApplicationDescriptor();
        if (desc != null) {
            url = url.replaceFirst(desc.getDescriptorName(), "#REPLACED#");
        }

        goldFileText(url);
View Full Code Here

TOP

Related Classes of org.auraframework.system.AuraContext

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.