Package org.auraframework.def

Examples of org.auraframework.def.DescriptorFilter


        List<SourceLoader> loaders = Lists.newArrayList((SourceLoader) loader);
        RootDefFactory factory = new RootDefFactory(new SourceFactory(loaders));

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

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


        addSourceAutoCleanup(ApplicationDef.class, baseContents, String.format("house%sparty", nonce));
        addSourceAutoCleanup(ApplicationDef.class, baseContents, String.format("pants%sparty", nonce));

        // Test wildcards
        assertEquals("find() fails with wildcard as prefix", 1,
                definitionService.find(new DescriptorFilter("*://" + houseboat.getDescriptorName())).size());
        assertEquals("find() fails with wildcard as namespace", 1,
                definitionService.find(new DescriptorFilter("markup://*:" + houseboat.getName())).size());
        assertEquals("find() fails with wildcard as name", 1,
                definitionService.find(new DescriptorFilter(houseboat.getQualifiedName())).size());
        assertEquals("find() fails with wildcard at end of name", 2,
                definitionService.find(new DescriptorFilter(String.format("markup://string:house%s*", nonce))).size());
        assertEquals("find() fails with wildcard at beginning of name", 2,
                definitionService.find(new DescriptorFilter(String.format("markup://string:*%sparty*", nonce))).size());
        assertEquals("find() should not find nonexistent name with preceeding wildcard", 0,
                definitionService.find(new DescriptorFilter("markup://string:*notherecaptain")).size());

        // Look in NonCachingDefRegistry
        assertTrue("find() should find results for markup://ui:outputNumber",
                definitionService.find(new DescriptorFilter("markup://ui:outputNumber")).size() > 0);
        assertTrue("find() fails with wildcard as prefix",
                definitionService.find(new DescriptorFilter("*://ui:outputNumber")).size() > 2);
        assertEquals("find() is finding non-existent items", 0,
                definitionService.find(new DescriptorFilter("markup://ui:doesntexist")).size());

        // Look in AuraStaticTypeDefRegistry (StaticDefRegistry)
        assertEquals("find() fails looking in StaticDefRegistry", 1,
                definitionService.find(new DescriptorFilter("aura://*:String")).size());
        // Look in AuraStaticControllerDefRegistry (StaticDefRegistry)
        assertEquals("find() fails looking in StaticDefRegistry", 1,
                definitionService.find(new DescriptorFilter("aura://*:ComponentController")).size());
        assertEquals("find() is finding non-existent items", 0,
                definitionService.find(new DescriptorFilter("aura://*:doesntexist")).size());

        // Find CSS
        DefDescriptor<ApplicationDef> appWithCss = getAuraTestingUtil().createStringSourceDescriptor(null,
                ApplicationDef.class, null);
        DefDescriptor<StyleDef> CSSdesc = Aura.getDefinitionService().getDefDescriptor(appWithCss,
                DefDescriptor.CSS_PREFIX, StyleDef.class);
        addSourceAutoCleanup(appWithCss, baseContents);
        addSourceAutoCleanup(CSSdesc, ".THIS { background: blue }");

        assertEquals("find() failed to find both markup and css file in same bundle", 2,
                definitionService.find(new DescriptorFilter("*://" + appWithCss.getDescriptorName())).size());
        assertEquals("find() did not find CSS file", 1,
                definitionService.find(new DescriptorFilter("css://" + appWithCss.getDescriptorName())).size());
        assertEquals("find() is finding non-existent CSS", 0,
                definitionService.find(new DescriptorFilter("css://*:doesntexist")).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.