@Test public void testAssertBehaviour() { Properties properties = new Properties(); properties.setProperty( "drools.equalityBehavior", "identity" ); RuleBaseConfiguration cfg = new RuleBaseConfiguration(properties); assertEquals( AssertBehaviour.IDENTITY, cfg.getAssertBehaviour() ); properties = new Properties(); properties.setProperty( "drools.equalityBehavior", "equality" ); cfg = new RuleBaseConfiguration(properties); assertEquals( AssertBehaviour.EQUALITY, cfg.getAssertBehaviour() ); }
@Test public void testSystemProperties() { RuleBaseConfiguration cfg = new RuleBaseConfiguration(); assertEquals( AssertBehaviour.IDENTITY, cfg.getAssertBehaviour() ); System.setProperty( "drools.equalityBehavior", "EQUALITY" ); cfg = new RuleBaseConfiguration(); assertEquals( AssertBehaviour.EQUALITY, cfg.getAssertBehaviour() ); System.getProperties().remove( "drools.equalityBehavior" ); }
@Test public void testProgrammaticPropertiesFile() { RuleBaseConfiguration cfg = new RuleBaseConfiguration(); assertEquals( true, cfg.isIndexLeftBetaMemory() ); Properties properties = new Properties(); properties.setProperty( "drools.indexLeftBetaMemory", "false" ); cfg = new RuleBaseConfiguration( properties ); assertEquals( false, cfg.isIndexLeftBetaMemory() ); System.getProperties().remove( "drools.indexLeftBetaMemory" ); }
private static ReteooBuilder[] getReteBuilders(int count) { System.out.println("Creating "+count+" ReteBuilder's"); ReteooBuilder[] reteBuilders = new ReteooBuilder[count]; RuleBaseConfiguration conf = new RuleBaseConfiguration(); for (int i = 0; i < reteBuilders.length; i++) { reteBuilders[i] = new ReteooBuilder(new KnowledgeBaseImpl( "id1", conf )); } return reteBuilders; }
@Test public void testSequential() { Properties properties = new Properties(); properties.setProperty( "drools.sequential", "false" ); RuleBaseConfiguration cfg = new RuleBaseConfiguration(properties); assertFalse( cfg.isSequential() ); assertTrue( cfg.getAgendaGroupFactory() instanceof PriorityQueueAgendaGroupFactory ); properties = new Properties(); properties.setProperty( "drools.sequential.agenda", "sequential" ); properties.setProperty( "drools.sequential", "true" ); cfg = new RuleBaseConfiguration(properties); assertTrue( cfg.isSequential() ); assertEquals( SequentialAgenda.SEQUENTIAL, cfg.getSequentialAgenda() ); properties = new Properties(); properties.setProperty( "drools.sequential.agenda", "dynamic" ); properties.setProperty( "drools.sequential", "true" ); cfg = new RuleBaseConfiguration(properties); assertTrue( cfg.isSequential() ); assertEquals( SequentialAgenda.DYNAMIC, cfg.getSequentialAgenda() ); assertTrue( cfg.getAgendaGroupFactory() instanceof PriorityQueueAgendaGroupFactory ); } }
public BuildContext createContext() { RuleBaseConfiguration conf = new RuleBaseConfiguration(); KnowledgeBaseImpl rbase = new KnowledgeBaseImpl( "ID", conf ); BuildContext buildContext = new BuildContext( rbase ); RuleImpl rule = new RuleImpl( "rule1").setPackage( "org.pkg1" ); InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.pkg1" ); pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() ); pkg.addRule( rule ); buildContext.setRule( rule ); return buildContext; }
public BuildContext createContext() { RuleBaseConfiguration conf = new RuleBaseConfiguration(); KnowledgeBaseImpl rbase = new KnowledgeBaseImpl( "ID", conf ); BuildContext buildContext = new BuildContext( rbase ); RuleImpl rule = new RuleImpl( "rule1").setPackage( "org.pkg1" ); InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.pkg1" ); pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() ); pkg.addRule( rule ); buildContext.setRule( rule ); return buildContext; }
public BuildContext createContext() { RuleBaseConfiguration conf = new RuleBaseConfiguration(); KnowledgeBaseImpl rbase = new KnowledgeBaseImpl( "ID", conf ); BuildContext buildContext = new BuildContext( rbase ); RuleImpl rule = new RuleImpl( "rule1").setPackage( "org.pkg1" ); InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.pkg1" ); pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() ); pkg.addRule( rule ); buildContext.setRule( rule ); return buildContext; } }
public BuildContext createContext() { RuleBaseConfiguration conf = new RuleBaseConfiguration(); KnowledgeBaseImpl rbase = new KnowledgeBaseImpl( "ID", conf ); BuildContext buildContext = new BuildContext( rbase ); RuleImpl rule = new RuleImpl( "rule1").setPackage( "org.pkg1" ); InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.pkg1" ); pkg.getDialectRuntimeRegistry().setDialectData( "mvel", new MVELDialectRuntimeData() ); pkg.addRule( rule ); buildContext.setRule( rule ); return buildContext; }
protected void checkBetaConstraints(BetaNodeFieldConstraint[] constraints, Class cls, short betaNodeType) { RuleBaseConfiguration config = new RuleBaseConfiguration(); int depth = config.getCompositeKeyDepth();
properties.setProperty("drools.shadowProxyExcludes", "org.drools.core.test.model.Cheese"); RuleBaseConfiguration conf = new RuleBaseConfiguration(properties); InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(conf); buildContext = new BuildContext(kBase);
assertFalse(kBuilder.getErrors().toString(), kBuilder.hasErrors()); final RuleBaseConfiguration conf = new RuleBaseConfiguration(); conf.setAssertBehaviour( RuleBaseConfiguration.AssertBehaviour.EQUALITY ); conf.setSequentialAgenda( RuleBaseConfiguration.SequentialAgenda.SEQUENTIAL );
ClassLoader classLoader = this.getClass().getClassLoader(); PackageBuilderConfiguration configuration = new PackageBuilderConfiguration(); configuration.setClassLoader(classLoader); PackageBuilder builder = new PackageBuilder(configuration); builder.addPackageFromDrl(source); RuleBaseConfiguration ruleBaseConfiguration = new RuleBaseConfiguration(); ruleBaseConfiguration.setClassLoader(classLoader); ruleBase = RuleBaseFactory.newRuleBase(ruleBaseConfiguration); ruleBase.addPackage(builder.getPackage());
BetaNodeFieldConstraint[] constraints = new BetaNodeFieldConstraint[] { constraint0 }; RuleBaseConfiguration config = new RuleBaseConfiguration();
BetaNodeFieldConstraint[] constraints = new BetaNodeFieldConstraint[]{constraint0}; RuleBaseConfiguration config = new RuleBaseConfiguration();
@Before public void setUp() throws Exception { RuleBaseConfiguration config = new RuleBaseConfiguration(); config.setPhreakEnabled(false); kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(); buildContext = new BuildContext(kBase, kBase.getReteooBuilder().getIdGenerator()); pctxFactory = kBase.getConfiguration().getComponentFactory().getPropagationContextFactory(); }
@Test public void testGetFactHandleIdentityBehavior() throws Exception { final RuleBaseConfiguration conf = new RuleBaseConfiguration(); conf.setAssertBehaviour( RuleBaseConfiguration.AssertBehaviour.IDENTITY ); InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(conf); kBase = SerializationHelper.serializeObject( kBase ); KieSession session = kBase.newKieSession(); CheeseEqual cheese = new CheeseEqual( "stilton", 10 ); session.insert( cheese ); FactHandle fh1 = session.getFactHandle( new Cheese( "stilton", 10 ) ); assertNull( fh1 ); FactHandle fh2 = session.getFactHandle( cheese ); assertNotNull( fh2 ); }
@Test public void testUnblockAll() { RuleBaseConfiguration conf = new RuleBaseConfiguration(); conf.setOption( RuleEngineOption.RETEOO );
@Test public void testKnowledgeHelperUpdate() { RuleBaseConfiguration conf = new RuleBaseConfiguration(); conf.setOption( RuleEngineOption.RETEOO );
@Test public void testAddition() { RuleBaseConfiguration conf = new RuleBaseConfiguration(); conf.setOption( RuleEngineOption.RETEOO );