Geoffrey Wiseman <geoffrey.wiseman <at> gmail.com> writes:
>
> On 2/22/06, Fanory <sgohory <at> club-internet.fr> wrote:
> >
> > Ok, thanks for the answers !
> > And the fact that i have tu put synchronized my setup method (which
> > instanciates WMs), is it correct ?
> > If i don't make this, my result are wrong ...
>
> On a quick scan, I'd think you'd need to synchronize loadRules() (or some
> part of it) to avoid a race condition there on the businessRules variable
> (simultaneous calls could cause one loadRules() method to overwrite the
> rules already loaded by another), but getWorkingMemory() should be ok
> without synchronization.
>
> What happens if you don't synchronize it?
>
> - Geoffrey
>
> PS: I hope your catch( Exception ) { return null; } isn't part of your
> long-term plans for production code; but that isn't what you're asking
> about.
> --
> Geoffrey Wiseman
>
If i don't put synchronized on my setup method, results are incorrect. (For
example, instances i'm sure that they have to exit with true value after rules
checking, exit with false !)
But i've made another tests, i use this code in place of loadTest junitperf
method:
BeneficiaryDroolsLayer.loadRules();
TestSuite suite = new ActiveTestSuite();
suite.addTest(BeneficiaryListTest.suite());
suite.addTest(new RepeatedTest(BeneficiaryListTest.suite(), 10));
suite.addTest(new RepeatedTest(BeneficiaryListTest.suite(), 25));
suite.addTest(new RepeatedTest(BeneficiaryListTest.suite(), 10));
suite.addTest(new RepeatedTest(BeneficiaryListTest.suite(), 50));
suite.addTest(BeneficiaryListTest.suite());
return suite;
In this case, i don't need to synchronized my setup ...
I'm surprise, maybe my knowledge of junitperf (and drools too) is bad ...
All this stuff is just some tests ... it's why my catch exception is not coded !
Thanks !