Package org.auraframework.test

Examples of org.auraframework.test.TestContextAdapter


                descriptor.getName(), defType == DefType.COMPONENT ? "cmp" : "app", nonce, context.getMode().name());

        String test = (String)component.getAttributes().getValue("test");
        tcds = filterTestCases(test);

        TestContextAdapter contextAdapter = Aura.get(TestContextAdapter.class);
        if (contextAdapter != null) {
            for (TestCaseDef tcd : tcds) {
                TestContext testContext = contextAdapter.getTestContext(tcd.getDescriptor().getQualifiedName());
                testContext.getLocalDefs().clear();
                testContext.getLocalDefs().addAll(tcd.getLocalDefs());
            }
        }
    }
View Full Code Here


            if (loadedStrings.size() > 0) {
                json.writeMapKey("loaded");
                json.writeMap(loadedStrings);
            }

            TestContextAdapter testContextAdapter = Aura.get(TestContextAdapter.class);
            if (testContextAdapter != null) {
                TestContext testContext = testContextAdapter.getTestContext();
                if (testContext != null) {
                    json.writeMapEntry("test", testContext.getName());
                }
            }
View Full Code Here

     * @param mockDefs the Definitions to be mocked
     * @throws Exception
     */
    public <D extends Definition> void mockDef(@SuppressWarnings("unchecked") D... mockDefs) throws Exception {
        if (mockDefs != null && mockDefs.length > 0) {
            TestContextAdapter testContextAdapter = Aura
                    .get(TestContextAdapter.class);
            TestContext testContext = testContextAdapter.getTestContext();
            if (testContext == null) {
                throw new IllegalStateException(
                        "TestContext not established; use TestContextAdapter.getTestContext(String).");
            }
            Set<Definition> mocks = testContext.getLocalDefs();
View Full Code Here

            counters.put(testContext, 0);
        }
    }
   
    private static TestContext getContextAdapter() {
        TestContextAdapter testContextAdapter = Aura.get(TestContextAdapter.class);
        return testContextAdapter.getTestContext();
    }
View Full Code Here

    }
   
        // Check for any local defs with this namespace and consider that as an indicator that we have a privileged
        // namespace
        if (namespace != null) {
            TestContextAdapter testContextAdapter = Aura.get(TestContextAdapter.class);
            if (testContextAdapter != null) {
                TestContext testContext = testContextAdapter.getTestContext();
                if (testContext != null) {
                    Set<Definition> localDefs = testContext.getLocalDefs();
                    for (Definition def : localDefs) {
                      DefDescriptor<? extends Definition> defDescriptor = def.getDescriptor();
                      if(defDescriptor!=null) {
View Full Code Here

                }
            }
        }

        if (!isProduction) {
            TestContextAdapter testContextAdapter = Aura.get(TestContextAdapter.class);
            if (testContextAdapter != null) {
                String testName = null;
                // config takes precedence over param because the value is not expected to change during a test and it
                // is less likely to have been modified unintentionally when from the config
                if (configMap != null) {
                    testName = (String) configMap.get("test");
                }
                if (testName == null) {
                    testName = test.get(request);
                }
                if (testName != null) {
                    TestContext testContext = testContextAdapter.getTestContext(testName);
                    if (testContext != null) {
                        MasterDefRegistry registry = context.getDefRegistry();
                        Set<Definition> mocks = testContext.getLocalDefs();
                        if (mocks != null) {
                            boolean doReset = testReset.get(request);
                            for (Definition def : mocks) {
                                if (doReset && def instanceof Resettable) {
                                    ((Resettable) def).reset();
                                }
                                registry.addLocalDef(def);
                            }
                        }
                    }
                } else {
                    testContextAdapter.clear();
                }
            }
        }

        return context;
View Full Code Here

TOP

Related Classes of org.auraframework.test.TestContextAdapter

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.