Thanks that did it!


From: lhorton <LHorton@ABCLegal.com>
To: rules-users@lists.jboss.org
Sent: Friday, September 23, 2011 6:33 PM
Subject: Re: [rules-users] Changeset does not monitor folder correctly

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.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users