options.setCheckLayout(true);
options.setCheckModuleSemantics(true);
options.setCheckReferences(true);
options.setFileType(FileType.PUPPET_ROOT);
BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));
AllModuleReferences exports = buildResult.getAllModuleReferences();
// dumpExports(exports);
Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/X"));
Export exporteda = exports.findExportedClass("aclass", visibleExports);
assertNotNull("Should have found exported 'aclass'", exporteda);
Export exportedb = exports.findExportedClass("bclass", visibleExports);
assertNotNull("Should have found exported 'bclass'", exportedb);
Export exportedc = exports.findExportedClass("cclass", visibleExports);
assertNull("Should not have found exported 'cclass'", exportedc);
Iterable<String> paramsForA = exports.getParameterNames(exporteda, visibleExports);
assertTrue("Should contain 'aparam'", Iterables.contains(paramsForA, "aparam"));
assertEquals("Should have one parameter", 1, Iterables.size(paramsForA));
// Test new API as well
List<AllModuleReferences.ClassDescription> classes = exports.getClassDescriptions(visibleExports);
Map<String, ClassDescription> classMap = Maps.newHashMap();
for(ClassDescription cd : classes)
classMap.put(cd.getExportedClass().getName(), cd);
assertTrue("Should contain 'aclass'", classMap.containsKey("aclass"));
assertTrue("Should contain 'bclass'", classMap.containsKey("bclass"));