@Test public void testVisit() throws Exception { PackageDescr packageDescr = getPackageDescr(Verifier.class.getResourceAsStream("Misc3.drl")); assertNotNull(packageDescr); packageDescrVisitor.visitPackageDescr(packageDescr); Collection<VerifierComponent> all = verifierData.getAll(); Set<String> names = new HashSet<String>(); for (VerifierComponent verifierComponent : all) { String path = verifierComponent.getPath(); System.out.println("-" + verifierComponent); if (verifierComponent.getDescr() != null) { System.out.println(" \n\t\t => " + verifierComponent.getDescr().getLine() + ":" + +verifierComponent.getDescr().getEndLine() + " " + verifierComponent.getDescr().getText()); } else { System.out.println(" \n\t\t => null for " + verifierComponent.getClass().getSimpleName()); } if (names.contains(path)) { fail("Dublicate path " + path); } else { names.add(path); } } assertNotNull(all); assertEquals(45, all.size()); }
public void visitPackageDescr(PackageDescr descr) throws UnknownDescriptionException, ClassNotFoundException, IOException { rulePackage = data.getPackageByName(descr.getName()); if (rulePackage == null) { rulePackage = new RulePackage(descr); rulePackage.setName(descr.getName()); data.add(rulePackage); } visitImports(descr.getImports()); TypeDeclarationDescrVisitor typeDeclarationDescrVisitor = new TypeDeclarationDescrVisitor(data); typeDeclarationDescrVisitor.visit(descr.getTypeDeclarations()); visitRules(descr.getRules()); }
PackageDescrVisitor { public void visitPackageDescr(PackageDescr descr) throws UnknownDescriptionException, ClassNotFoundException, IOException { rulePackage = data.getPackageByName(descr.getName()); if (rulePackage == null) { rulePackage = new RulePackage(descr); rulePackage.setName(descr.getName()); data.add(rulePackage); } visitImports(descr.getImports()); TypeDeclarationDescrVisitor typeDeclarationDescrVisitor = new TypeDeclarationDescrVisitor(data); typeDeclarationDescrVisitor.visit(descr.getTypeDeclarations()); visitRules(descr.getRules()); } }
PackageDescrVisitor { public void visitPackageDescr(PackageDescr descr) throws UnknownDescriptionException, ClassNotFoundException, IOException { rulePackage = data.getPackageByName(descr.getName()); if (rulePackage == null) { rulePackage = new RulePackage(descr); rulePackage.setName(descr.getName()); data.add(rulePackage); } visitImports(descr.getImports()); TypeDeclarationDescrVisitor typeDeclarationDescrVisitor = new TypeDeclarationDescrVisitor(data); typeDeclarationDescrVisitor.visit(descr.getTypeDeclarations()); visitRules(descr.getRules()); } PackageDescrVisitor(VerifierData data,
                               List<JarInputStream> jars); }
PackageDescrVisitor { public void visitPackageDescr(PackageDescr descr) throws UnknownDescriptionException, ClassNotFoundException, IOException { rulePackage = data.getPackageByName(descr.getName()); if (rulePackage == null) { rulePackage = new RulePackage(descr); rulePackage.setName(descr.getName()); data.add(rulePackage); } visitImports(descr.getImports()); TypeDeclarationDescrVisitor typeDeclarationDescrVisitor = new TypeDeclarationDescrVisitor(data); typeDeclarationDescrVisitor.visit(descr.getTypeDeclarations()); visitRules(descr.getRules()); } PackageDescrVisitor(VerifierData data,
                               List<JarInputStream> jars); void visitPackageDescr(PackageDescr descr); }
PackageDescrVisitor { public void visitPackageDescr(PackageDescr descr) throws UnknownDescriptionException, ClassNotFoundException, IOException { rulePackage = data.getPackageByName(descr.getName()); if (rulePackage == null) { rulePackage = new RulePackage(descr); rulePackage.setName(descr.getName()); data.add(rulePackage); } visitImports(descr.getImports()); TypeDeclarationDescrVisitor typeDeclarationDescrVisitor = new TypeDeclarationDescrVisitor(data); typeDeclarationDescrVisitor.visit(descr.getTypeDeclarations()); visitRules(descr.getRules()); } PackageDescrVisitor(VerifierData data,
                               List<JarInputStream> jars); void visitPackageDescr(PackageDescr descr);  }