Here is more info. The rule is firing by drool and the collection is being validated correctly. That is, here is the console log output:
2012-02-07 13:22:17,437 [main] INFO o.hibernate.validator.util.Version - Hibernate Validator 4.1.0.Final 2012-02-07 13:22:17,444 [main] INFO o.h.v.e.r.DefaultTraversableResolver - Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. 2012-02-07 13:22:19,350 [main] DEBUG c.b.csp.core.drools.DroolsValidator - Performing validations on PlatformEntity : com.betfair.csp.core.model.Account using Drools rules. ==>[ObjectInsertedEventImpl: getFactHandle()=[fact 0:2:1519302:1519302:2:DEFAULT:com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6], getObject()=com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@fe7f80, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:2:1519302:1519302:2:DEFAULT:com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6], leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]]OBJECT ASSERTED value:com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6 factId: 2
==>[ActivationCreatedEvent: getActivation()=[Activation rule=Address StreetLine1 Required, act#=0, salience=10, tuple=[fact 0:11:18628673:1772750:11:null:[com.betfair.csp.core.model.Address@1b0caf]] [fact 0:3:3306125:3306125:3:DEFAULT:com.betfair.csp.core.model.Account@32728d] [fact 0:2:1519302:1519302:2:DEFAULT:com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6] ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@fe7f80] ACTIVATION CREATED rule:Address StreetLine1 Required activationId:Address StreetLine1 Required [11, 3, 2] declarations: $errorHolder=com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6(2); $account=com.betfair.csp.core.model.Account@32728d(3); $badAddresses=[com.betfair.csp.core.model.Address@1b0caf](11) ==>[ObjectInsertedEventImpl: getFactHandle()=[fact 0:3:3306125:3306125:3:DEFAULT:com.betfair.csp.core.model.Account@32728d], getObject()=com.betfair.csp.core.model.Account@32728d, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@fe7f80, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:3:3306125:3306125:3:DEFAULT:com.betfair.csp.core.model.Account@32728d], leftTuple=null, originOffset=-1, propagationNumber=3, rule=null, type=0]] OBJECT ASSERTED value:com.betfair.csp.core.model.Account@32728d factId: 3 ==>[BeforeActivationFiredEvent: getActivation()=[Activation rule=Address StreetLine1 Required, act#=0, salience=10, tuple=[fact 0:11:18628673:1772750:11:null:[com.betfair.csp.core.model.Address@1b0caf]] [fact 0:3:3306125:3306125:3:DEFAULT:com.betfair.csp.core.model.Account@32728d] [fact 0:2:1519302:1519302:2:DEFAULT:com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6] ], getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@fe7f80] BEFORE ACTIVATION FIRED rule:Address StreetLine1 Required activationId:Address StreetLine1 Required [11, 3, 2] declarations: $errorHolder=com.betfair.csp.core.drools.RulesValidationErrorHolder@172ec6(2); $account=com.betfair.csp.core.model.Account@32728d(3); $badAddresses=[com.betfair.csp.core.model.Address@1b0caf](11)
However, the validation seems to continue or attempt to validate the collection without activating the drools rule. Maybe I am misinterpreting the output. Here is the rest of the log with the test being ran fully.
2012-02-07 14:27:38,944 [main] DEBUG c.b.csp.core.drools.DroolsValidator - Validations on PlatformEntity : com.betfair.csp.core.model.Account using Drools FAILED. Constraint Violations are RulesValidationError[ message={csp.core.address.streetLine1.notnull} field=streetLine1 payload=Address[ id=<null> streetLine1=<null> streetLine2=<null> city=City state=State[ value=Colorado name=CO ordinal=5 ] zipCode=<null> zipExt=<null> country=Country[ value=Andorra name=AD ordinal=4 ] verified=<null> addressType=<null> description=<null> additionalInfo=<null> creatorApplicationId=<null> creatorUserCredentialId=<null> modifierUserCredentialId=<null> createTime=<null> modifierApplicationId=<null> lastUpdateTime=<null> entityState=<null> className=<null> ] ] 2012-02-07 14:27:39,113 [main] DEBUG c.b.csp.core.drools.DroolsValidator - Performing validations on PlatformEntity : com.betfair.csp.core.model.Address using Drools rules. ==>[ObjectInsertedEventImpl: getFactHandle()=[fact 0:2:7384438:7384438:2:DEFAULT:com.betfair.csp.core.drools.RulesValidationErrorHolder@70ad76], getObject()=com.betfair.csp.core.drools.RulesValidationErrorHolder@70ad76, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@18c2354, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:2:7384438:7384438:2:DEFAULT:com.betfair.csp.core.drools.RulesValidationErrorHolder@70ad76], leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]] OBJECT ASSERTED value:com.betfair.csp.core.drools.RulesValidationErrorHolder@70ad76 factId: 2 ==>[ObjectInsertedEventImpl: getFactHandle()=[fact 0:3:5709968:5709968:3:DEFAULT:com.betfair.csp.core.model.Address@572090], getObject()=com.betfair.csp.core.model.Address@572090, getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@18c2354, getPropagationContext()=PropagationContextImpl [activeActivations=0, dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact 0:3:5709968:5709968:3:DEFAULT:com.betfair.csp.core.model.Address@572090], leftTuple=null, originOffset=-1, propagationNumber=3, rule=null, type=0]] OBJECT ASSERTED value:com.betfair.csp.core.model.Address@572090 factId: 3 2012-02-07 14:27:42,182 [main] DEBUG c.b.csp.core.drools.DroolsValidator - Validation on PlatformEntity : com.betfair.csp.core.model.Address using Drools SUCCEEDED (3069 msec) 2012-02-07 14:27:42,182 [main] DEBUG c.b.csp.core.drools.DroolsValidator - Performing validations on PlatformEntity : com.betfair.csp.core.model.Address using Drools rules.
To tomyun-what is thinking,thinking?
|