Package org.auraframework.service

Examples of org.auraframework.service.ContextService


            assertLocation(e, filePath);
        }
    }

    protected void endContextIfEstablished() {
        ContextService contextService = Aura.getContextService();
        if (contextService != null && contextService.isEstablished()) {
            contextService.endContext();
        }
    }
View Full Code Here


    @UnAdaptableTest
    public static class NamespaceTestSuite extends TestSuite {
        public NamespaceTestSuite(String namespace) throws Exception {
            super(namespace);
            ContextService contextService = Aura.getContextService();
            DefinitionService definitionService = Aura.getDefinitionService();

            boolean contextStarted = false;
            if (!contextService.isEstablished()) {
                contextStarted = true;
                contextService.startContext(Mode.JSTEST, Format.JSON, Authentication.AUTHENTICATED);
            }

            Map<String, TestSuite> subSuites = new HashMap<>();
            try {
                DescriptorFilter filter = new DescriptorFilter("js://"+namespace, DefType.TESTSUITE.toString());
                Set<DefDescriptor<?>> descriptors = definitionService.find(filter);

                for (DefDescriptor<?> qd  : descriptors) {
                    @SuppressWarnings("unchecked")
                    DefDescriptor<TestSuiteDef> descriptor = (DefDescriptor<TestSuiteDef>)qd;
                    Test test;
                    try {
                        test = new ComponentTestSuite(descriptor.getDef());
                    } catch (Throwable t) {
                        test = new FailTestCase(descriptor, t);
                    }
                    String testNamespace = descriptor.getNamespace();
                    if (namespace.equals(testNamespace)) {
                        addTest(test);
                    } else {
                        TestSuite subSuite = subSuites.get(testNamespace);
                        if (subSuite == null) {
                            subSuite = new TestSuite(testNamespace);
                            subSuites.put(testNamespace, subSuite);
                            addTest(subSuite);
                        }
                        subSuite.addTest(test);
                    }
                }
            } catch (Throwable t) {
                System.err.println("Failed to load component tests for namespace: " + namespace);
                t.printStackTrace();
            } finally {
                if (contextStarted) {
                    contextService.endContext();
                }
            }
        }
View Full Code Here

        /**
         * @return Returns the code.
         * @throws QuickFixException
         */
        public String getCode() throws QuickFixException {
            ContextService contextService = Aura.getContextService();
            boolean isEstablished = contextService.isEstablished();
            if (!isEstablished) {
                contextService.startContext(Mode.AUTOJSTEST, Format.JSON, Authentication.AUTHENTICATED);
            }
            try {
                return descriptor.getDef().getCode();
            } finally {
                if (!isEstablished) {
                    contextService.endContext();
                }
            }
        }
View Full Code Here

public abstract class AbstractRendererForTestingIntegrationService implements Renderer {

    protected void injectComponent(String tag, Map<String, Object> attributes, String localId, String locatorDomId,
            Appendable out, boolean useAsync, String applicationTag) throws AuraRuntimeException, QuickFixException, IOException {
        ContextService contextService = Aura.getContextService();
        AuraContext ctx = contextService.getCurrentContext();
        contextService.endContext();

        Integration integration = Aura.getIntegrationService().createIntegration(
                "", Mode.DEV, true, null, applicationTag, null);
        integration.injectComponent(tag, attributes, localId, locatorDomId, out, useAsync);

        // The only not-so-ideal part of this approach to testing
        // IntegrationService is that we have to start the
        // context for the rendering of the original stub component to continue.
        // IntegrationService sets up and tears down its context.
        contextService.startContext(ctx.getMode(), ctx.getFormat(), ctx.getAccess(),
                ctx.getApplicationDescriptor());
    }
View Full Code Here

    @Override
    protected void setupValidateReferences() throws Exception {
        super.setupValidateReferences();
       
        ContextService contextService = Aura.getContextService();
    if (testAuraContext != null) {
            contextService.endContext();
        }
       
        testAuraContext = contextService.startContext(Mode.UTEST, Format.JSON, Authentication.AUTHENTICATED);
    }
View Full Code Here

    public AuraContextServiceImplTest(String name) {
        super(name, false);
    }

    public void testAuraContextServiceImpl() {
        ContextService contextService = Aura.getContextService();
        assertTrue(contextService instanceof AuraContextServiceImpl);
    }
View Full Code Here

        assertTrue(contextService instanceof AuraContextServiceImpl);
    }

    public void testTestContext() {
        // can only test the test context
        ContextService contextService = Aura.getContextService();
        ContextAdapter p = AuraImpl.getContextAdapter();
        assertFalse(p.isEstablished());
        contextService.startContext(Mode.DEV, Format.JSON, Authentication.AUTHENTICATED);
        assertTrue(p.isEstablished());
        assertNotNull(p.getCurrentContext());

        contextService.endContext();
        assertFalse(p.isEstablished());
    }
View Full Code Here

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
            IOException {
        SerializationService serializationService = Aura.getSerializationService();
        LoggingService loggingService = Aura.getLoggingService();
        ContextService contextService = Aura.getContextService();
        ServerService serverService = Aura.getServerService();
        AuraContext context = contextService.getCurrentContext();
        response.setCharacterEncoding(UTF_ENCODING);
        boolean written = false;
        setNoCache(response);

        try {
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.