[rules-users] Rule Templates

FrankVhh frank.vanhoenshoven at agserv.eu
Fri Jul 27 11:14:57 EDT 2012


>The information that would help me is (using Eclipse or JBDS) can one edit, 
It depends if you mean edit the templates or edit the data that you use to
populate it.

You can create a rule template in any text editor you like and, AFAIK, it
can have any extension you prefer. Convert it to an inputstream and use it
in the code as is documented.

Regarding the data source, you have multiple options to collect the data.
Editing this data depends a bit on the type you are using. I typically
convert xml objects to java objects and use (and, sometimes, abuse) them to
fill the template and "generate" rules. 

>compile to drl 
Compile to drl is done using the code as documented.

String drl = converter.compile( objs, templateStream );

You can do with the String whatever you like. use it to feed a
knowledgebuilder directly, or write it to a file.

>and test the rule templates
Again. This depends on what you mean. If test the rule templates means:
"check whether it generates a correct drl", than there are 2 things you can
do.
1) Manually check that the rules are as you expect them to be.
2) Verify that the drl compiles in a knowledgebuilder.

If "test" means, check whether my generated rules can construct a correct
decision, then you wikk have to set up a service/a method/ a unit test in
which you use the rules to create a knowledge base and which takes input
data to generate a certain output.

If you want, you can use guvnor to create test scenarios or implement a
testing tool by your own.

Regards,
Frank


mclovis wrote
> 
> Frank,
>      Thank you for your quick reply. I had previously read your suggested
> documentation and understand the basics of rule templates. The information
> that would help me is (using Eclipse or JBDS) can one edit, compile to drl
> and test the rule templates. The information in the article does not
> reflect these things and furthermore has a lists of file types for Drools
> that is not in current versions of IDEs (example: rules resource). If you
> have knowledge of the mechanics of these things (using even Ant or Maven
> to compile), it would be much appreciated. 
> 
> Thanks in advance,
> 
> Mike
> 




--
View this message in context: http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p4018956.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list