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());
}