package com.rmn.eoodu.service.security.drools;
import com.rmn.eoodu.service.security.impl.UserLoginServiceImpl;
import com.rmn.eoodu.service.security.dos.UserLogin;
import com.rmn.eoodu.service.message.Messages;
import com.rmn.eoodu.service.message.Message;
global com.rmn.eoodu.service.message.Messages drlMessages;
import function com.rmn.eoodu.service.utils.DroolsUtils.validatePassword;
import function com.rmn.eoodu.service.utils.DroolsUtils.checkNullOrEmpty;
import function com.rmn.eoodu.service.utils.DroolsUtils.checkEquals;
rule "checkUserName"
activation-group "validateUser"
lock-on-active true
salience 100
when
UserLogin($user:userLogin)
eval(checkNullOrEmpty($user)==true)
then
drlMessages.addErrorMessage("LoginForm_UserName","InvalidUserName","UserName
cannot be empty",5);
System.out.println("Rule1: checkUserName ");
end
rule "checkingTheLengthOfName"
activation-group "validateUser"
lock-on-active true
salience 99
when
UserLogin($user:userLogin)
eval ($user.length() < 3)
then
drlMessages.addErrorMessage("LoginForm_UserName","InvalidName","UserName
should not be less than 3 letters",3);
System.out.println("Rule2:checkingTheLengthOfName ");
end
rule "isPasswordEmpty"
activation-group "validatePwd"
lock-on-active true
salience 98
when
UserLogin($pwd : password)
eval(checkNullOrEmpty($pwd)==true)
then
drlMessages.addErrorMessage("LoginForm_Password","InvalidPassword","Password
should not be empty",5);
System.out.println("Rule3: isPasswordEmpty");
end
rule "validatingLengthOfPwd"
activation-group "validatePwd"
lock-on-active true
salience 97
when
UserLogin($pwd : password)
eval(validatePassword($pwd)==true)
then
drlMessages.addErrorMessage("LoginForm_Password","InvalidPassword","Please
check the length of the password once",4);
System.out.println("Rule4: validatingLengthOfPwd");
end
rule "userNameandPasswordAreNotEqual"
activation-group "validateForm"
//agenda-group "validateTheForm"
lock-on-active true
salience 96
when
UserLogin($user : userLogin , $pwd : password)
eval((validatePassword($pwd)==false) && (checkNullOrEmpty($pwd)==false))
eval(checkEquals($user,$pwd)==true)
then
drlMessages.addErrorMessage("LoginForm_UserName_Password","Invlid
UserName & Password","UserName and Password Cannot be Same",1);
System.out.println("Rule5: userNameandPasswordAreNotEqual");
end
Hai here i dont want to test like eval((validatePassword($pwd)==false) &&
(checkNullOrEmpty($pwd)==false)). I need a helper class to test this. Can
any body help me in writing a helper class here for it.
--
View this message in context:
http://drools.46999.n3.nabble.com/Needed-help-for-helper-class-tp3917108p...
Sent from the Drools: Developer (committer) mailing list mailing list archive at
Nabble.com.