[rules-users] Changeset does not monitor folder correctly

lhorton LHorton at ABCLegal.com
Fri Sep 23 18:33:17 EDT 2011


I wrote a small test for loading your drl files with different change sets,
and both methods worked fine and the rules executed the same way for both. 
I don't have time today to do a more extensive test.

my change sets are:

<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns="http://drools.org/drools-5.0/change-set"
			xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
			xs:schemaLocation="http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd">
	<add>
		<resource type="DRL" source="file:///C:/rule/directory/test.drl"/>
		<resource type="DRL" source="file:///C:/rule/directory/test-two.drl"/>
	</add>
</change-set>

and for the directory one:

<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns="http://drools.org/drools-5.0/change-set"
			xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
			xs:schemaLocation="http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd">
	<add>
		<resource type="DRL" source="file:///C:/rule/directory"/>
	</add>
</change-set>

source for my test is:

		KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("myagent");
		kagent.applyChangeSet(ResourceFactory.newFileResource(
"C:/rules/resources/ChangeSetDrl.xml"));
		KnowledgeBase kbase = kagent.getKnowledgeBase();
		StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
		Patient p = new Patient();
		p.setCreateDate(new Date());
		p.setUserId(5);
		System.out.println("START EXECUTE WITH DRL CHANGE SET");
		ksession.execute(p);
		kagent.dispose();
		System.out.println("END EXECUTE WITH DRL CHANGE SET");

		kagent = KnowledgeAgentFactory.newKnowledgeAgent("myagent");
		kagent.applyChangeSet(ResourceFactory.newFileResource(
"C:/rules/resources/ChangeSetDir.xml"));
		kbase = kagent.getKnowledgeBase();
		ksession = kbase.newStatelessKnowledgeSession();
		p = new Patient();
		p.setCreateDate(new Date());
		p.setUserId(5);
		System.out.println("START EXECUTE WITH DIRECTORY CHANGE SET");
		ksession.execute(p);
		System.out.println("END EXECUTE WITH DIRECTORY CHANGE SET");
		kagent.dispose();


and the output from the test is:

START EXECUTE WITH DRL CHANGE SET
User 5 Fri Sep 23 15:26:16 PDT 2011 (package test)
Patient 5 Fri Sep 23 15:26:16 PDT 2011(package test)
Hello World package test
Hello World TWO package test two
Hello World ONE package test two
END EXECUTE WITH DRL CHANGE SET

START EXECUTE WITH DIRECTORY CHANGE SET
User 5 Fri Sep 23 15:26:16 PDT 2011 (package test)
Patient 5 Fri Sep 23 15:26:16 PDT 2011(package test)
Hello World package test
Hello World TWO package test two
Hello World ONE package test two
END EXECUTE WITH DIRECTORY CHANGE SET



--
View this message in context: http://drools.46999.n3.nabble.com/Changeset-does-not-monitor-folder-correctly-tp3337573p3363189.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list