diff --git a/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/InputFieldValidators.md2 b/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/InputFieldValidators.md2 index 5a5a63cc..e20d4359 100644 --- a/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/InputFieldValidators.md2 +++ b/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/InputFieldValidators.md2 @@ -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 + } } diff --git a/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/RootValidators.md2 b/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/RootValidators.md2 index 210b9e32..e8e17eba 100644 --- a/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/RootValidators.md2 +++ b/de.wwu.md2.framework.tests/models/de/wwu/md2/framework/tests/dsl/controller/validator/RootValidators.md2 @@ -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 -} - - diff --git a/de.wwu.md2.framework.tests/src/de/wwu/md2/framework/tests/dsl/controller/validator/ValidatorTests.xtend b/de.wwu.md2.framework.tests/src/de/wwu/md2/framework/tests/dsl/controller/validator/ValidatorTests.xtend index ee9040ac..f395938c 100644 --- a/de.wwu.md2.framework.tests/src/de/wwu/md2/framework/tests/dsl/controller/validator/ValidatorTests.xtend +++ b/de.wwu.md2.framework.tests/src/de/wwu/md2/framework/tests/dsl/controller/validator/ValidatorTests.xtend @@ -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; } @@ -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);