Package org.auraframework.system

Examples of org.auraframework.system.AuraContext


        assertLocaleProperties(Arrays.asList(new Locale("fr", "FR")), localeProperties);
    }
   
    private void assertLocaleProperties(List<Locale> localeList,
            HashMap<String, Object> localeProperties) {
        AuraContext context = Aura.getContextService().getCurrentContext();
        context.setRequestedLocales(localeList == null ? null : localeList);
        LocaleValueProvider lvp = new LocaleValueProvider();
        String countryName = localeList == null ? "" : localeList.get(0).getCountry();
        for (Map.Entry<String, Object> entry : localeProperties.entrySet()) {
            assertLocaleProperty(lvp, entry.getKey(), entry.getValue(), countryName);
        }
View Full Code Here


    /**
     * Test to verify getValue returns null for undefined property
     * @throws Exception
     */
  public void testGetValueUndefinedProperty() throws Exception {
    AuraContext context = Aura.getContextService().getCurrentContext();
        context.setRequestedLocales(Arrays.asList(Locale.UK));
      LocaleValueProvider lvp = new LocaleValueProvider();
      assertEquals(null,
                lvp.getValue(new PropertyReferenceImpl("ISO3Language", null))); // undefined
                                                                                // property
    }
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
    private void assertDateLocaleProperties(Locale locale, String dateName,
            HashMap<String, String> expectedData) {
        AuraContext context = Aura.getContextService().getCurrentContext();
        context.setRequestedLocales(locale == null ? null : Arrays.asList(locale));
        LocaleValueProvider lvp = new LocaleValueProvider();
       
        ArrayList<LocalizedLabel> values = (ArrayList<LocalizedLabel>) lvp.getData().get(dateName);
        Set<String> expectedShortNames = expectedData.keySet();
        for (int i=0; i<values.size(); i++) {
View Full Code Here

                    expectedData.get(shortName), fullName);
        }
    }  
       
    private void assertTodayLocaleProperty(Locale locale, String expectedLabel) {
        AuraContext context = Aura.getContextService().getCurrentContext();
        context.setRequestedLocales(locale == null ? null : Arrays.asList(locale));
        LocaleValueProvider lvp = new LocaleValueProvider();
        String actualLabel = (String) lvp.getData().get(LocaleValueProvider.TODAY_LABEL);
        assertEquals("Today label for locale " + locale + " is incorrect", expectedLabel, actualLabel);
    }
View Full Code Here

     */
    public void testWriteCssWithoutDupes() throws Exception {
        ServerService ss = Aura.getServerService();
        DefDescriptor<ApplicationDef> appDesc = Aura.getDefinitionService()
                .getDefDescriptor("preloadTest:test_SimpleApplication", ApplicationDef.class);
        AuraContext context = Aura.getContextService()
                .startContext(Mode.DEV, AuraContext.Format.CSS, AuraContext.Authentication.AUTHENTICATED, appDesc);
        final String uid = context.getDefRegistry().getUid(null, appDesc);
        context.addLoaded(appDesc, uid);

        Set<DefDescriptor<?>> dependencies = context.getDefRegistry().getDependencies(uid);
       
        StringWriter output = new StringWriter();
        ss.writeAppCss(dependencies, output);

        // A snippet of component css
View Full Code Here

    public void testPreloadCSSDependencies() throws Exception {
        ServerService ss = Aura.getServerService();
        DefDescriptor<ComponentDef> appDesc = Aura.getDefinitionService()
                .getDefDescriptor("clientApiTest:cssStyleTest", ComponentDef.class);
        AuraContext context = Aura.getContextService().startContext(AuraContext.Mode.DEV, AuraContext.Format.CSS,
                AuraContext.Authentication.AUTHENTICATED, appDesc);
        final String uid = context.getDefRegistry().getUid(null, appDesc);
        context.addLoaded(appDesc, uid);

        Set<DefDescriptor<?>> dependencies = context.getDefRegistry().getDependencies(uid);

        StringWriter output = new StringWriter();
        ss.writeAppCss(dependencies, output);

        String sourceNoWhitespace = output.toString().replaceAll("\\s", "");
View Full Code Here

     */
    public void testWriteDefinitionsWithoutDupes() throws Exception {
        ServerService ss = Aura.getServerService();
        DefDescriptor<ApplicationDef> appDesc = Aura.getDefinitionService()
                .getDefDescriptor("appCache:withpreload", ApplicationDef.class);
        AuraContext context = Aura.getContextService()
                .startContext(Mode.DEV, AuraContext.Format.JS, AuraContext.Authentication.AUTHENTICATED, appDesc);
        final String uid = context.getDefRegistry().getUid(null, appDesc);
        context.addLoaded(appDesc, uid);

        Set<DefDescriptor<?>> dependencies = context.getDefRegistry().getDependencies(uid);

        // prime def cache
        StringWriter output = new StringWriter();
        ss.writeDefinitions(dependencies, output);
        String text = output.toString();
View Full Code Here

    public void testPreloadJSDependencies() throws Exception {
        ServerService ss = Aura.getServerService();
        DefDescriptor<ComponentDef> appDesc = Aura.getDefinitionService()
                .getDefDescriptor("clientApiTest:cssStyleTest", ComponentDef.class);
        AuraContext context = Aura.getContextService().startContext(AuraContext.Mode.DEV, AuraContext.Format.JS,
                AuraContext.Authentication.AUTHENTICATED, appDesc);
        final String uid = context.getDefRegistry().getUid(null, appDesc);
        context.addLoaded(appDesc, uid);

        Set<DefDescriptor<?>> dependencies = context.getDefRegistry().getDependencies(uid);

        StringWriter output = new StringWriter();
        ss.writeDefinitions(dependencies, output);

        String sourceNoWhitespace = output.toString().replaceAll("\\s", "");
View Full Code Here

            source.append(String.format("<aura:dependency resource=\"%s:*\" type=\"*\" />", ns));
        }
        source.append("</aura:application>");

        DefDescriptor<ApplicationDef> appDesc = addSourceAutoCleanup(ApplicationDef.class, source.toString());
        AuraContext context = Aura.getContextService().startContext(AuraContext.Mode.PROD, AuraContext.Format.JS,
                AuraContext.Authentication.AUTHENTICATED, appDesc);
        final String uid = context.getDefRegistry().getUid(null, appDesc);
        context.addLoaded(appDesc, uid);
        Set<DefDescriptor<?>> dependencies = context.getDefRegistry().getDependencies(uid);

        ServerService ss = Aura.getServerService();
        StringWriter output = new StringWriter();
        ss.writeDefinitions(dependencies, output);

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

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.