Package org.auraframework.def

Examples of org.auraframework.def.DescriptorFilter


        Set<String> prefixes = Sets.newHashSet();
        Set<DefType> types = Sets.newHashSet();
        Set<DefDescriptor<?>> descriptors;
        List<Definition> defs = Lists.newArrayList();
        MasterDefRegistry mdr = Aura.getContextService().getCurrentContext().getDefRegistry();
        DescriptorFilter root_nsf = new DescriptorFilter(namespace,
                "COMPONENT,APPLICATION,EVENT,INTERFACE,LIBRARY,THEME,DOCUMENTATION,TESTSUITE,NAMESPACE,LAYOUTS,LAYOUT");
        Map<DefDescriptor<?>, Definition> filtered;
        Set<String> namespaces = Sets.newHashSet(namespace);
        //
        // Fetch all matching descriptors for our 'root' definitions.
View Full Code Here


        String name = (String) Aura.getContextService().getCurrentContext().getCurrentComponent().getAttributes()
                .getValue("name");

        if (name != null && !name.isEmpty()) {
            Set<DefDescriptor<?>> descriptors = definitionService.find(new DescriptorFilter("markup://" + name));
            if (descriptors.size() > 0) {
                for (DefDescriptor<?> descriptor : descriptors) {

                    DefType type = descriptor.getDefType();
                    switch (type) {
View Full Code Here

    private QuickFixException error;

    protected DependencyDefImpl(Builder builder) {
        super(builder);

        DescriptorFilter tmp = null;
        QuickFixException caught = null;

        this.parentDescriptor = builder.parentDescriptor;
        if (builder.resource != null) {
            try {
                tmp = new DescriptorFilter(builder.resource, builder.type);
            } catch (IllegalArgumentException iae) {
                caught = new InvalidDefinitionException(iae.getMessage(), getLocation());
            }
        } else {
            caught = new InvalidDefinitionException("Missing required resource", getLocation());
View Full Code Here

    /**
     * @return all descriptors known by the Aura runtime
     */
    public static Set<DefDescriptor<?>> getAllKnownDescriptors() throws QuickFixException {
        DefinitionService definitionService = Aura.getDefinitionService();
        Set<DefDescriptor<?>> descriptors = definitionService.find(new DescriptorFilter("*://*:*"));
        Set<DefDescriptor<?>> includedDescriptors = new HashSet<DefDescriptor<?>>();

        // add bundle ones from RootDefinition elements
        Set<DefDescriptor<?>> bundlesDescriptors = new HashSet<DefDescriptor<?>>();
        for (DefDescriptor<?> descriptor : descriptors) {
View Full Code Here

            } finally {
                rLock.unlock();
            }
        }
        if (localDescs != null) {
            DescriptorFilter filter = new DescriptorFilter(matcher.getQualifiedName());
            for (DefDescriptor<? extends Definition> desc : localDescs) {
                if (filter.matchDescriptor(desc)) {
                    @SuppressWarnings("unchecked")
                    DefDescriptor<D> localDesc = (DefDescriptor<D>) desc;
                    matched.add(localDesc);
                }
            }
View Full Code Here

                String.format("%s:pantsparty", namespace));

        MasterDefRegistryImpl masterDefReg = getDefRegistry(false);

        assertTrue("find() not finding all sources",
                masterDefReg.find(new DescriptorFilter(String.format("markup://%s:*", namespace))).size() == 3);
        assertEquals("find() fails with wildcard as prefix", 1,
                masterDefReg.find(new DescriptorFilter("*://" + houseboat.getDescriptorName())).size());
        assertEquals("find() fails with wildcard as namespace", 1,
                masterDefReg.find(new DescriptorFilter("markup://*:" + houseboat.getName())).size());
        assertEquals("find() fails with wildcard as name", 1,
                masterDefReg.find(new DescriptorFilter(houseboat.getQualifiedName())).size());
        assertEquals("find() fails with wildcard at end of name", 2,
                masterDefReg.find(new DescriptorFilter(String.format("markup://%s:house*", namespace))).size());
        assertEquals("find() fails with wildcard at beginning of name", 2,
                masterDefReg.find(new DescriptorFilter(String.format("markup://%s:*party*", namespace))).size());

        assertEquals("find() should not find nonexistent name", 0,
                masterDefReg.find(new DescriptorFilter(String.format("markup://%s:househunters", namespace))).size());
        assertEquals("find() should not find nonexistent name ending with wildcard", 0,
                masterDefReg.find(new DescriptorFilter(String.format("markup://%s:househunters*", namespace))).size());
        assertEquals("find() should not find nonexistent name with preceeding wildcard", 0,
                masterDefReg.find(new DescriptorFilter(String.format("markup://%s:*notherecaptain", namespace))).size());
    }
View Full Code Here

        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:*");
        Set<DefDescriptor<?>> results2 = mdr.find(filter2);
        assertTrue("results2 should be cached", isInDescriptorFilterCache(filter2, results2, mdri));

        DescriptorFilter filter3 = new DescriptorFilter("*://cstring:*");
        Set<DefDescriptor<?>> results3 = mdr.find(filter3);
        assertFalse("results3 should not be cached", isInDescriptorFilterCache(filter3, results3, mdri));
        DescriptorFilter filter4 = new DescriptorFilter("*://cstring1:*");
        Set<DefDescriptor<?>> results4 = mdr.find(filter4);
        assertFalse("results4 should be cached", isInDescriptorFilterCache(filter4, results4, mdri));

        DescriptorFilter filter5 = new DescriptorFilter("*://*:*");
        Set<DefDescriptor<?>> results5 = mdr.find(filter5);
        assertFalse("results5 should not be cached", isInDescriptorFilterCache(filter5, results5, mdri));
        // DescriptorFilter filter6 = new DescriptorFilter("*://*test:*");
        // Set<DefDescriptor<?>> results6 = mdr.find(filter6);
        // assertFalse("results6 should be cached", isInDescriptorFilterCache(filter6, results6, mdri));
View Full Code Here

    public void testFindMatcherLocking() throws Exception {
        LockTestInfo lti = null;

        lti = new LockTestInfo();
        try {
            lti.mdr.find(new DescriptorFilter("bah:humbug"));
            Mockito.verify(lti.rLock, Mockito.times(1)).lock();
            Mockito.verify(lti.rLock, Mockito.times(1)).unlock();
            lti.mdr.find(new DescriptorFilter("bah:humbug"));
            // we always lock, so we cannot check for a single lock here.
            Mockito.verify(lti.rLock, Mockito.times(2)).lock();
            Mockito.verify(lti.rLock, Mockito.times(2)).unlock();
            Mockito.verify(lti.wLock, Mockito.never()).lock();
            Mockito.verify(lti.wLock, Mockito.never()).unlock();
View Full Code Here

                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;
View Full Code Here

    public void testFindRegex() {
        FileSourceLoader loader = new FileSourceLoader(AuraImplFiles.TestComponents.asFile());
        Set<DefDescriptor<?>> found;

        found = loader.find(new DescriptorFilter("markup://test:extendsParent"));
        assertEquals("Should have found a single component", 1, found.size());
        assertTrue(found.contains(DefDescriptorImpl.getInstance("markup://test:extendsParent", ComponentDef.class)));

        // Number of results can change if files modified so just check at least
        // 2 results from wildcard search since
        // components are more likely to be added than deleted.
        found = loader.find(new DescriptorFilter("markup://test:style*"));
        assertTrue("Should have found multiple components", found.size() > 1);
        assertTrue(found.contains(DefDescriptorImpl.getInstance("markup://test:styleTestTemplate", ComponentDef.class)));
        assertTrue(found.contains(DefDescriptorImpl.getInstance("markup://test:styleTest", ApplicationDef.class)));

        found = loader.find(new DescriptorFilter("markup://test:doesntexist"));
        assertEquals("Should not have found any components", 0, found.size());
    }
View Full Code Here

TOP

Related Classes of org.auraframework.def.DescriptorFilter

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.