use of org.kie.api.runtime.ClassObjectFilter in project drools by kiegroup.
the class SubsumptantRestrictionsTest method testVerifierLiteralRestrictionRedundancy2.
@Test
public void testVerifierLiteralRestrictionRedundancy2() throws Exception {
VerifierBuilder vBuilder = VerifierBuilderFactory.newVerifierBuilder();
Verifier verifier = vBuilder.newVerifier();
verifier.addResourcesToVerify(ResourceFactory.newClassPathResource("SubsumptantRestriction2.drl", getClass()), ResourceType.DRL);
// for ( VerifierError error : verifier.getMissingClasses() ) {
// System.out.println( error.getMessage() );
// }
assertFalse(verifier.hasErrors());
boolean noProblems = verifier.fireAnalysis();
assertTrue(noProblems);
Collection<? extends Object> subsumptionList = ((VerifierImpl) verifier).getKnowledgeSession().getObjects(new ClassObjectFilter(Subsumption.class));
assertEquals(9, subsumptionList.size());
verifier.dispose();
}
use of org.kie.api.runtime.ClassObjectFilter in project drools by kiegroup.
the class SubsumptantRestrictionsTest method testVerifierLiteralRestrictionRedundancy4.
@Test
public void testVerifierLiteralRestrictionRedundancy4() throws Exception {
VerifierBuilder vBuilder = VerifierBuilderFactory.newVerifierBuilder();
Verifier verifier = vBuilder.newVerifier();
verifier.addResourcesToVerify(ResourceFactory.newClassPathResource("SubsumptantRestriction4.drl", getClass()), ResourceType.DRL);
// for ( VerifierError error : verifier.getMissingClasses() ) {
// System.out.println( error.getMessage() );
// }
assertFalse(verifier.hasErrors());
boolean noProblems = verifier.fireAnalysis();
assertTrue(noProblems);
Collection<? extends Object> subsumptionList = ((VerifierImpl) verifier).getKnowledgeSession().getObjects(new ClassObjectFilter(Subsumption.class));
// for ( Object object : subsumptionList ) {
// System.out.println( object );
// }
assertEquals(4, subsumptionList.size());
verifier.dispose();
}
use of org.kie.api.runtime.ClassObjectFilter in project drools by kiegroup.
the class SubsumptantSubPatternsTest method testSubpatternSubsumption3.
/**
* Different sources
*
* @throws Exception
*/
@Test
public void testSubpatternSubsumption3() throws Exception {
VerifierBuilder vBuilder = VerifierBuilderFactory.newVerifierBuilder();
Verifier verifier = vBuilder.newVerifier();
verifier.addResourcesToVerify(ResourceFactory.newClassPathResource("SubsumptantSubPatterns3.drl", getClass()), ResourceType.DRL);
// for ( VerifierError error : verifier.getMissingClasses() ) {
// System.out.println( error.getMessage() );
// }
assertFalse(verifier.hasErrors());
boolean noProblems = verifier.fireAnalysis();
assertTrue(noProblems);
Collection<? extends Object> subsumptionList = ((VerifierImpl) verifier).getKnowledgeSession().getObjects(new ClassObjectFilter(Subsumption.class));
int count = 0;
for (Object object : subsumptionList) {
// System.out.println( " * " + ((Subsumption) object) );
if (((VerifierComponent) ((Subsumption) object).getLeft()).getVerifierComponentType().equals(VerifierComponentType.SUB_PATTERN)) {
count++;
}
}
assertEquals(1, count);
verifier.dispose();
}
Aggregations