public class CatalogModel {
private final List<Map<String, String>> components = Lists.newArrayList();
public CatalogModel() throws QuickFixException {
DefinitionService definitionService = Aura.getDefinitionService();
DefDescriptor<ComponentDef> matcher = definitionService.getDefDescriptor("markup://*:*", ComponentDef.class);
Set<DefDescriptor<ComponentDef>> descriptors = definitionService.find(matcher);
for (DefDescriptor<ComponentDef> desc : descriptors) {
Map<String, String> values = Maps.newHashMap();
values.put("name", desc.getDescriptorName());
try {
ComponentDef def = desc.getDef();
values.put("support", def.getSupport().name());
} catch (Throwable t) {
values.put("support", "ERROR");
}
try {
TestSuiteDef suite = definitionService.getDefDescriptor(desc, "js", TestSuiteDef.class).getDef();
values.put("tests", "" + suite.getTestCaseDefs().size());
} catch (Throwable t) {
values.put("tests", "0");
}
components.add(values);