Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bonita
bonita-studio
Commits
c90d56b7
Commit
c90d56b7
authored
Nov 05, 2014
by
Romain Bioteau
Browse files
BS-11320
Fix recursive algorithm
parent
ebc46c4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
bundles/plugins/org.bonitasoft.studio.validation/src-test/java/org/bonitasoft/studio/validation/constraints/process/EndingPageflowConstraintTest.java
View file @
c90d56b7
...
...
@@ -88,6 +88,18 @@ public class EndingPageflowConstraintTest {
assertThat
(
constraintUnderTest
.
performBatchValidation
(
context
).
isOK
()).
isTrue
();
}
@Test
public
void
shouldPerformBatchValidation_ReturnValidStatus_For_Pageflow_With_Group_And_SubmitButton
()
throws
Exception
{
final
Task
pageflow
=
ProcessFactory
.
eINSTANCE
.
createTask
();
final
Form
formWithSubmitButton
=
FormFactory
.
eINSTANCE
.
createForm
();
final
Group
group
=
FormFactory
.
eINSTANCE
.
createGroup
();
formWithSubmitButton
.
getWidgets
().
add
(
group
);
formWithSubmitButton
.
getWidgets
().
add
(
FormFactory
.
eINSTANCE
.
createSubmitFormButton
());
pageflow
.
getForm
().
add
(
formWithSubmitButton
);
when
(
context
.
getTarget
()).
thenReturn
(
pageflow
);
assertThat
(
constraintUnderTest
.
performBatchValidation
(
context
).
isOK
()).
isTrue
();
}
@Test
public
void
shouldPerformBatchValidation_ReturnErrorStatus_For_Pageflow_Without_SubmitButton
()
throws
Exception
{
final
Task
pageflow
=
ProcessFactory
.
eINSTANCE
.
createTask
();
...
...
bundles/plugins/org.bonitasoft.studio.validation/src/org/bonitasoft/studio/validation/constraints/process/EndingPageflowConstraint.java
View file @
c90d56b7
...
...
@@ -66,13 +66,15 @@ AbstractLiveValidationMarkerConstraint {
return
context
.
createSuccessStatus
();
}
p
ublic
boolean
containsSubmitButton
(
final
List
<
Widget
>
widgets
){
p
rotected
boolean
containsSubmitButton
(
final
List
<
Widget
>
widgets
)
{
for
(
final
Widget
widget
:
widgets
)
{
if
(
widget
instanceof
SubmitFormButton
){
return
true
;
}
if
(
widget
instanceof
Group
)
{
return
containsSubmitButton
(((
Group
)
widget
).
getWidgets
());
if
(
containsSubmitButton
(((
Group
)
widget
).
getWidgets
()))
{
return
true
;
}
}
}
return
false
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment