Skip to content

Commit

Permalink
Fix broken validator test due to new DSL structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
maltemoeser committed Dec 19, 2014
1 parent 80869d1 commit bd70ec4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
package controllers

action CustomAction assignValidators {
bind validators NotNullValidator (message "ID must not be null!") NumberRangeValidator (message "ID must between 1 and 666!") on complaintView.complaintID
bind validator StringRangeValidator (maxLength 150, minLength 1, message "the string is too short or too long!") on complaintView.descriptionTxt
bind validator RegExValidator (regEx "[A-Za-Z]+@[a-z]{2,6}", message "that's not a valid email address") on complaintView.userEmail
bind validator DateRangeValidator (min 1900-01-01, message "the string is too short or too long!") on complaintView.submitDate
WorkflowElement Test {
defaultProcessChain MyProcessChain
onInit {
action CustomAction init{
}
}

processChain MyProcessChain {
step MediaCapturing:
view myView
}

action CustomAction assignValidators {
bind validators NotNullValidator (message "ID must not be null!") NumberRangeValidator (message "ID must between 1 and 666!") on complaintView.complaintID
bind validator StringRangeValidator (maxLength 150, minLength 1, message "the string is too short or too long!") on complaintView.descriptionTxt
bind validator RegExValidator (regEx "[A-Za-Z]+@[a-z]{2,6}", message "that's not a valid email address") on complaintView.userEmail
bind validator DateRangeValidator (min 1900-01-01, message "the string is too short or too long!") on complaintView.submitDate
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,3 @@ remoteConnection myConnection {
password "admin"
user "admin"
}


//assign Validators to input fields

action CustomAction assignValidators {
bind validators NotNullValidator (message "ID must not be null!") NumberRangeValidator (message "ID must between 1 and 666!") on complaintView.complaintID
bind validator StringRangeValidator (maxLength 150, minLength 1, message "the string is too short or too long!") on complaintView.descriptionTxt
bind validator RegExValidator (regEx "[A-Za-Z]+@[a-z]{2,6}", message "that's not a valid email address") on complaintView.userEmail
bind validator DateRangeValidator (min 1900-01-01, message "the string is too short or too long!") on complaintView.submitDate
}


Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class ValidatorTests {
validators = elements.filter(typeof(Validator)).toList;

ifv_elements = (inputFieldValidatorModel.modelLayer as Controller).controllerElements;
actions = ifv_elements.filter(typeof(CustomAction)).toList;
var workflowElement = ifv_elements.filter(typeof(WorkflowElement)).head as WorkflowElement;
actions = workflowElement.actions.filter(typeof(CustomAction)).toList;
tasks = actions.get(0).codeFragments.filter(typeof(ValidatorBindingTask)).toList;

}
Expand All @@ -73,7 +74,7 @@ class ValidatorTests {
@Test
def validatorNamesTest(){
"validateComplaintID".assertEquals(validators.get(0).name);
"validateDesctription".assertEquals(validators.get(1).name);
"validateDescription".assertEquals(validators.get(1).name);
"validateUserEmail".assertEquals(validators.get(2).name);
"validateDate".assertEquals(validators.get(3).name);
"myRemoteValidator".assertEquals(validators.get(4).name);
Expand Down

0 comments on commit bd70ec4

Please sign in to comment.