Examples of ConfigAdapter


Examples of org.auraframework.adapter.ConfigAdapter

        boolean cacheable = false;
        if (namespace == null) {
            if (prefix == null) {
                cacheable = false;
            } else {
                ConfigAdapter configAdapter = Aura.getConfigAdapter();
                cacheable = configAdapter.isCacheablePrefix(prefix);
            }
        } else if (prefix == null) {
            ConfigAdapter configAdapter = Aura.getConfigAdapter();
            cacheable = configAdapter.isPrivilegedNamespace(namespace);
        } else {
            ConfigAdapter configAdapter = Aura.getConfigAdapter();
            cacheable = configAdapter.isCacheablePrefix(prefix) || configAdapter.isPrivilegedNamespace(namespace);
        }
        return cacheable;
    }
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

    public SourceFactory(Collection<SourceLoader> loaders) {
        Map<LoaderKey, SourceLoader> mutableLoaderMap = new HashMap<>();
        Set<String> mutableNamespaces = new HashSet<>();

        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        for (SourceLoader loader : loaders) {
            for (String namespace : loader.getNamespaces()) {
                mutableNamespaces.add(namespace);
               
                // Track and system/privileged namespaces
                //
                // This code is rather broken, as this now assumes that we build source factories for every
                // loader. It is not fully compatible with having compiled registries, and we now have a hack
                // to make it work.
                //
                if (loader instanceof PrivilegedNamespaceSourceLoader) {
                  PrivilegedNamespaceSourceLoader privilegedLoader = (PrivilegedNamespaceSourceLoader)loader;
                  if (privilegedLoader.isPrivilegedNamespace(namespace)) {
                    configAdapter.addPrivilegedNamespace(namespace);
                  }
                }

                for (String prefix : loader.getPrefixes()) {
                    LoaderKey key = new LoaderKey(namespace, prefix);
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

    }

    public void testNonPrivilegedStringCache() throws Exception {
        String namespace = "testNonPrivilegedStringCache" + getAuraTestingUtil().getNonce();

        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        assertFalse(namespace + "  should not have been isPriveleged", configAdapter.isPrivilegedNamespace(namespace));
        DefDescriptor<ApplicationDef> houseboat = getAuraTestingUtil().addSourceAutoCleanup(ApplicationDef.class,
                String.format(baseApplicationTag, "", ""), String.format("%s:houseboat", namespace), false);
        MasterDefRegistryImpl masterDefReg = getDefRegistry(false);
        String uid = masterDefReg.getUid(null, houseboat);
        assertNull("Found string in new MDR", masterDefReg.getCachedString(uid, houseboat, "test1"));
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

        mdr.assertAccess(desc, desc.getDef(), mockAccessCheckCache);
        verify(mockAccessCheckCache, times(2)).getIfPresent(anyString());
    }

    public void testExistsCache() throws Exception {
        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        MasterDefRegistry mdr = getAuraMDR();
        MasterDefRegistryImpl mdri = (MasterDefRegistryImpl) mdr;
        Map<DefType, DefDescriptor<?>> defs = addDefsToCaches(mdri);
        Map<DefType, DefDescriptor<?>> nonPrivDefs = addNonPriveledgedDefsToMDR(mdri);
        for (DefDescriptor<?> dd : defs.values()) {
            assertTrue(dd + " should exist.", dd.exists());
        }
        for (DefDescriptor<?> dd : nonPrivDefs.values()) {
            assertTrue(dd + " should exist.", dd.exists());
        }

        DefDescriptor<?> nsDef = defs.get(DefType.NAMESPACE);
        DefDescriptor<?> layoutDef = defs.get(DefType.LAYOUTS);
        DefDescriptor<?> rendererDef = defs.get(DefType.RENDERER);
        DefDescriptor<?> appDef = defs.get(DefType.APPLICATION);
        DefDescriptor<?> controllerDef = defs.get(DefType.CONTROLLER);
        DefDescriptor<?> cmpDef = defs.get(DefType.COMPONENT);

        DefDescriptor<?> npNSDef = nonPrivDefs.get(DefType.NAMESPACE);
        DefDescriptor<?> npLayoutDef = nonPrivDefs.get(DefType.LAYOUTS);
        DefDescriptor<?> npRendererDef = nonPrivDefs.get(DefType.RENDERER);
        DefDescriptor<?> nsAppDef = nonPrivDefs.get(DefType.APPLICATION);
        DefDescriptor<?> nsControllerDef = nonPrivDefs.get(DefType.CONTROLLER);
        DefDescriptor<?> nsCmpDef = nonPrivDefs.get(DefType.COMPONENT);

        // only picking 3 defs to test the ns as they are mostly dupes
        assertTrue(nsDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(nsDef.getNamespace()));
        assertTrue(layoutDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(layoutDef.getNamespace()));
        assertTrue(rendererDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(rendererDef.getNamespace()));

        assertFalse(npLayoutDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npLayoutDef.getNamespace()));
        assertFalse(npNSDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npNSDef.getNamespace()));
        assertFalse(npRendererDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npRendererDef.getNamespace()));

        MasterDefRegistry mdr2 = restartContextGetNewMDR();
        MasterDefRegistryImpl mdri2 = (MasterDefRegistryImpl) mdr2;

        // objects wont be in eists cache yet, just defsCache, need to call exists to prime exists cache
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

        assertFalse("nsController is not in cache", isInExistsCache(nsControllerDef, mdri3));
        assertFalse("nsCmp is not in cache", isInExistsCache(nsCmpDef, mdri3));
    }

    public void testDefsCache() throws Exception {
        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        MasterDefRegistry mdr = getAuraMDR();
        MasterDefRegistryImpl mdri = (MasterDefRegistryImpl) mdr;
        Map<DefType, DefDescriptor<?>> defs = addDefsToCaches(mdri);
        Map<DefType, DefDescriptor<?>> nonPrivDefs = addNonPriveledgedDefsToMDR(mdri);

        DefDescriptor<?> nsDef = defs.get(DefType.NAMESPACE);
        DefDescriptor<?> layoutDef = defs.get(DefType.LAYOUTS);
        DefDescriptor<?> rendererDef = defs.get(DefType.RENDERER);
        DefDescriptor<?> appDef = defs.get(DefType.APPLICATION);
        DefDescriptor<?> controllerDef = defs.get(DefType.CONTROLLER);
        DefDescriptor<?> cmpDef = defs.get(DefType.COMPONENT);

        DefDescriptor<?> npNSDef = nonPrivDefs.get(DefType.NAMESPACE);
        DefDescriptor<?> npLayoutDef = nonPrivDefs.get(DefType.LAYOUTS);
        DefDescriptor<?> npRendererDef = nonPrivDefs.get(DefType.RENDERER);
        DefDescriptor<?> nsAppDef = nonPrivDefs.get(DefType.APPLICATION);
        DefDescriptor<?> nsControllerDef = nonPrivDefs.get(DefType.CONTROLLER);
        DefDescriptor<?> nsCmpDef = nonPrivDefs.get(DefType.COMPONENT);

        // only picking 3 defs to test the ns as they are mostly dupes
        assertTrue(nsDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(nsDef.getNamespace()));
        assertTrue(layoutDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(layoutDef.getNamespace()));
        assertTrue(rendererDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(rendererDef.getNamespace()));

        assertFalse(npLayoutDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npLayoutDef.getNamespace()));
        assertFalse(npNSDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npNSDef.getNamespace()));
        assertFalse(npRendererDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npRendererDef.getNamespace()));

        assertTrue("nsDef is in cache", isInDefsCache(nsDef, mdri));
        assertTrue("LayoutsDef is in cache", isInDefsCache(layoutDef, mdri));
        assertTrue("RendererDef is in cache", isInDefsCache(rendererDef, mdri));
        assertTrue("app is in cache", isInDefsCache(appDef, mdri));
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

        assertFalse("nsController is not in cache", isInDefsCache(nsControllerDef, mdri2));
        assertFalse("nsCmp is not in cache", isInDefsCache(nsCmpDef, mdri2));
    }

    public void testDescriptorFilterCache() throws Exception {
        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        MasterDefRegistry mdr = getAuraMDR();
        MasterDefRegistryImpl mdri = (MasterDefRegistryImpl) mdr;
        Map<DefType, DefDescriptor<?>> defs = addDefsToCaches(mdri);
        Map<DefType, DefDescriptor<?>> nonPrivDefs = addNonPriveledgedDefsToMDR(mdri);

        DefDescriptor<?> nsDef = defs.get(DefType.NAMESPACE);
        DefDescriptor<?> layoutDef = defs.get(DefType.LAYOUTS);
        DefDescriptor<?> rendererDef = defs.get(DefType.RENDERER);

        DefDescriptor<?> npNSDef = nonPrivDefs.get(DefType.NAMESPACE);
        DefDescriptor<?> npLayoutDef = nonPrivDefs.get(DefType.LAYOUTS);
        DefDescriptor<?> npRendererDef = nonPrivDefs.get(DefType.RENDERER);

        // only picking 3 defs to test the ns as they are mostly dupes
        assertTrue(nsDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(nsDef.getNamespace()));
        assertTrue(layoutDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(layoutDef.getNamespace()));
        assertTrue(rendererDef.getNamespace() + "  should have been isPriveleged",
                configAdapter.isPrivilegedNamespace(rendererDef.getNamespace()));

        assertFalse(npLayoutDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npLayoutDef.getNamespace()));
        assertFalse(npNSDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npNSDef.getNamespace()));
        assertFalse(npRendererDef.getNamespace() + "  should not have been isPriveleged",
                configAdapter.isPrivilegedNamespace(npRendererDef.getNamespace()));

        DescriptorFilter filter = new DescriptorFilter("*://test:*");
        Set<DefDescriptor<?>> results = mdr.find(filter);
        assertTrue("results should be cached", isInDescriptorFilterCache(filter, results, mdri));
        DescriptorFilter filter2 = new DescriptorFilter("*://gvpTest:*");
 
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

                ComponentDef.class,
                String.format(baseComponentTag, "access='global'",
                        String.format("<%s/>", unprivilegedCmp.getDescriptorName())),
                null, true);

        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        assertTrue(configAdapter.isPrivilegedNamespace(privilegedCmp.getNamespace()));
        assertFalse(configAdapter.isPrivilegedNamespace(unprivilegedCmp.getNamespace()));
        assertTrue(configAdapter.isPrivilegedNamespace(privilegedRoot.getNamespace()));

        MasterDefRegistry mdr = Aura.getContextService().getCurrentContext().getDefRegistry();
        MasterDefRegistryImpl mdri = (MasterDefRegistryImpl) mdr;
        mdr.getDef(privilegedCmp);
        assertTrue(isInDepsCache(privilegedCmp, mdri));
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

                "java://org.auraframework.java.controller.TestController", ControllerDef.class);
        controllerDef.getDef();
        String prefix = controllerDef.getPrefix();
        assertEquals(prefix, "java");

        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        assertFalse(configAdapter.isPrivilegedNamespace(controllerDef.getNamespace()));

        MasterDefRegistry mdr = Aura.getContextService().getCurrentContext().getDefRegistry();
        // mdr.getDef(controllerDef);
        MasterDefRegistryImpl mdri = (MasterDefRegistryImpl) mdr;
        assertTrue(isInDepsCache(controllerDef, mdri));
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

        super(name);
    }

    @UnAdaptableTest
    public void testServicesAndAdaptersRegistered() {
        ConfigAdapter c = Aura.getConfigAdapter();
        assertNotNull(c);
        assertTrue("Expected MockConfigAdapterImpl to be registered in AuraImplTestConfig",
                c instanceof MockConfigAdapterImpl);
        assertTrue("Failed to get expected implementation of service.",
                Aura.get(ConfigAdapter.class) instanceof MockConfigAdapterImpl);
View Full Code Here

Examples of org.auraframework.adapter.ConfigAdapter

        List<TreeNode> ret = Lists.newArrayList();

        Map<String, TreeNode> namespaceTreeNodes = Maps.newHashMap();
        DefDescriptor<E> matcher = definitionService.getDefDescriptor(String.format("%s://*%s*", prefix, sep), type);
        Set<DefDescriptor<E>> descriptors = definitionService.find(matcher);
        ConfigAdapter configAdapter = Aura.getConfigAdapter();
        for (DefDescriptor<E> desc : descriptors) {
            if (desc == null) {
                // Getting null here after commit 2037c31ddc81eae3edaf6ddd5bcfd0009fefe1bd. This causes a NPE and
                // breaks the left nav of the reference tab.
                continue;
            }
            String namespace = desc.getNamespace();
            if (configAdapter.isDocumentedNamespace(namespace)) {
                try {
                    E def = desc.getDef();
                    if (hasAccess(def)) {
                        TreeNode namespaceTreeNode = namespaceTreeNodes.get(desc.getNamespace());
                        if (namespaceTreeNode == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.