Hi Susan,
The junit examples are in the same zip bundle. I downloaded from the
jboss rules site, and here they are in the test/com/cnwk/pluto
directory.
So if you look at any of these tests:
PetStoreTest.java
PythonPetStoreTest.java
HelloWorldTest.java
you will see this standard pattern:
public static Test suite() {
TestSuite suite = new TestSuite(PythonPetStoreTest.class);
TestSetup wrapper = new TestSetup(suite) {
protected void setUp() throws Exception {
client = new DBClient(RuleTestUtils.getDataSource(),
null);
petStoreRuleSet =
RuleTestUtils.getPetStoreDynamicPythonRuleSet();
saveRule(client, petStoreRuleSet);
}
protected void tearDown() throws Exception {
removeRule(client, petStoreRuleSet.getName());
}
};
return wrapper;
}
If you comment out the call to removeRule() and run the tests using "ant
clean compile compile-test test", and assuming that you have your
database set up to receive these rules (see doc/ruledb_pgsql.sql or
doc/ruledb_mysql.sql for examples of what the schema looks like for
PostgreSQL and MySQL), at the end of the test you should have three
rulesets defined.
I guess I should have used something simpler like DbUnit to do this, but
unfortunately I just learned how to use DbUnit last week in connection
with something else I was doing :-(.
-sujit
On Tue, 2006-04-04 at 13:05, Susan G Lee wrote:
> Thanks Sujit,
>
> I can't find the link to download the junit examples. can someone provide
> the link?
>
>
> Thanks,
> Susan G. Lee
>
>
>
>
> Sujit Pal <[EMAIL PROTECTED]>
> 04/04/2006 02:46 PM
> Please respond to
> [email protected]
>
>
> To
> [email protected]
> cc
>
> Subject
> RE: [drools-user] Storing rules in a database
>
>
>
>
>
>
> Hi Susan,
>
> Sorry about the delay in replying.
>
> If you look at the JUnit tests, there is code there to put in:
> a) the Hello World ruleset.
> b) the Petstore ruleset with Java conditions and consequences
> c) the Petstore ruleset with Python conditions and consequences.
>
> The JUnit tests populate these rulesets and then delete them on
> completion, but if yuo comment out the delete logic and run the tests,
> then your database should be populated.
>
> -sujit
>
> On Mon, 2006-04-03 at 10:15, Susan G Lee wrote:
> > Does anyone have sample data for the tables used in this example? I
> think
> > it would make it easier to understand if that's provided.
> >
> >
> > Thanks,
> > Susan G. Lee
> >
> >
> >
> >
> >
> > "Ishafizan Ishak" <[EMAIL PROTECTED]>
> > 03/30/2006 12:49 AM
> > Please respond to
> > [email protected]
> >
> >
> > To
> > <[email protected]>
> > cc
> >
> > Subject
> > RE: [drools-user] Storing rules in a database
> >
> >
> >
> >
> >
> > Appreciate the help, found it at
> >
> http://www.drools.org/Loading+and+managing+rules+dynamically+from+a+database
>
> >
> >
> > includes a web interface too. Very nice!
> >
> > thanks
> > i.ishak
> > -----Original Message-----
> > From: Michael Neale [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, March 30, 2006 1:13 PM
> > To: [email protected]
> > Subject: Re: [drools-user] Storing rules in a database
> >
> > They should be in the articles section at www.drools.org (along with
> > downloads - Sujits implementation works with the python semantics).
> >
> > On 3/30/06, Ishafizan Ishak <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > " I found an example of storing rules in a database using hibernate
> > > > technology "
> > > " I think you may be referring to the article I submitted "
> > >
> > > Can u share me the links to these examples/articles pls?
> > >
> > > Thank u very much
> > > i.ishak
> > >
> > >
> > > -----Original Message-----
> > > From: Susan G Lee [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, March 30, 2006 5:11 AM
> > > To: [email protected]
> > > Subject: Re: [drools-user] Storing rules in a database
> > >
> > > Hi Sujit,
> > >
> > > Thank you so much for your input. You have veen very helpful.
> > >
> > >
> > > Thanks,
> > > Susan G. Lee
> > >
> > >
> > >
> > >
> > >
> > > Sujit Pal <[EMAIL PROTECTED]>
> > > 03/29/2006 03:58 PM
> > > Please respond to
> > > [email protected]
> > >
> > >
> > > To
> > > [email protected]
> > > cc
> > >
> > > Subject
> > > Re: [drools-user] Storing rules in a database
> > >
> > >
> > >
> > >
> > >
> > >
> > > Hi Susan,
> > >
> > > I think you may be referring to the article I submitted. An approach
> > > using stored procedures should be similar, all the hibernate code does
> > > is to persist and retrieve the object mapping to and from the
> database,
> > > so if you had stored procedures to do the same mappings, then that
> would
> > > work too. The only thing to note is that not all databases support
> > > stored procedures, and for those that do, stored procedure dialects
> are
> > > different enough so the solution would be tied to a single database.
> So
> > > a solution with stored procedures would not be a generic one.
> > >
> > > Michael Neale has written a repository api for Drools3 which allows
> you
> > > to plug in your repository implementation. The database implementation
> > > is based on hibernate, but it should be easy enough to replace the
> > > mappings with stored procedures, if you really wanted to go that
> route.
> > >
> > > HTH
> > > -sujit
> > >
> > > On Wed, 2006-03-29 at 11:46, Susan G Lee wrote:
> > > > Hi,
> > > >
> > > > I found an example of storing rules in a database using hibernate
> > > > technology. Is there another example of using it w/ stored
> procedures
> > > > calling the database to generate the rules? or is hibernate the only
> > > way?
> > > >
> > > >
> > > >
> > > > Thanks,
> > > > Susan G. Lee
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>