public void testRuleBaseAddRemoveSubNetworks() throws Exception {
try {
//add and remove
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( );
Collection<KnowledgePackage> kpkgs = loadKnowledgePackages("test_DynamicRulesWithSubnetwork.drl");
KnowledgePackage kpkg = ( KnowledgePackage ) kpkgs.toArray()[0];
kbase.addKnowledgePackages(kpkgs);
kbase.removeKnowledgePackage(kpkg.getName());
//add and remove again
kpkgs = loadKnowledgePackages("test_DynamicRulesWithSubnetwork.drl");
kpkg = ( KnowledgePackage ) kpkgs.toArray()[0];
kbase.addKnowledgePackages(kpkgs);
kbase.removeKnowledgePackage(kpkg.getName());
} catch ( Exception e ) {
e.printStackTrace();
fail( "Should not raise any exception" );
}
}