Java Code Examples for org.eclipse.core.databinding.UpdateValueStrategy#validateAfterGet()

The following examples show how to use org.eclipse.core.databinding.UpdateValueStrategy#validateAfterGet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConstraintNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_constraint_name_already_exists() throws Exception {
    final ConstraintNameObservableEditingSupport editingSupport = new ConstraintNameObservableEditingSupport(aTableViewer(), null,
            new EMFDataBindingContext());

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContract()
            .havingConstraint(aContractConstraint().withName("checkFirstName"), aContractConstraint().withName("checkLastName"))
            .build().getConstraints().get(1));
    final IStatus status = convertStrategy.validateAfterGet("checkFirstName");

    assertThat(status).isNotOK();
}
 
Example 2
Source File: ConstraintNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_constraint_name_is_longer_than_50_chars() throws Exception {
    final ConstraintNameObservableEditingSupport editingSupport = new ConstraintNameObservableEditingSupport(aTableViewer(), null,
            new EMFDataBindingContext());

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(null);
    final IStatus status = convertStrategy
            .validateAfterGet("dfhdshfdkjshfdkjshdsfdsdsffdsfdsffkjdshfdkjsfhkjsdhf");

    assertThat(status).isNotOK();
}
 
Example 3
Source File: InputNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_not_fails_validation_if_input_name_already_exists_at_another_level() throws Exception {
    final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(aTableViewer(), messageManager,
            new EMFDataBindingContext(), refactorOperationFactory, progressService);

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContract()
            .havingInput(aContractInput().withName("firstName"), aContractInput().withName("manager").havingInput(aContractInput().withName("lastName")))
            .build().getInputs().get(1).getInputs().get(0));
    final IStatus status = convertStrategy.validateAfterGet("firstName");

    assertThat(status).isOK();
}
 
Example 4
Source File: InputNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_input_name_already_exists_at_same_level() throws Exception {
    final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(aTableViewer(), messageManager,
            new EMFDataBindingContext(), refactorOperationFactory, progressService);

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContract()
            .havingInput(aContractInput().withName("firstName"), aContractInput().withName("lastName"))
            .build().getInputs().get(1));
    final IStatus status = convertStrategy.validateAfterGet("firstName");

    assertThat(status).isNotOK();
}
 
Example 5
Source File: InputNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_input_name_is_empty_exists() throws Exception {
    final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(aTableViewer(),
            messageManager, new EMFDataBindingContext(), refactorOperationFactory, progressService);

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContractInput().build());
    final IStatus status = convertStrategy.validateAfterGet("");

    assertThat(status).isNotOK();
}
 
Example 6
Source File: InputNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_input_name_is_longer_than_50_chars_exists() throws Exception {
    final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(aTableViewer(),
            messageManager, new EMFDataBindingContext(), refactorOperationFactory, progressService);

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContractInput().build());
    final IStatus status = convertStrategy
            .validateAfterGet("afkjdshfkjdhsfkjdhsfkjhdskjfhdkjshfdkjshfkjdshfdkjshfkjsdhfkjsdhfkjsdhfkjsdhfkjdshfdkjshfkjdshfdkjshfdkjshf");

    assertThat(status).isNotOK();
}
 
Example 7
Source File: InputNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_input_name_is_not_a_valid_java_identifiable() throws Exception {
    final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(aTableViewer(),
            messageManager, new EMFDataBindingContext(), refactorOperationFactory, progressService);

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContractInput().build());
    final IStatus status = convertStrategy
            .validateAfterGet("1startsWithOne");

    assertThat(status).isNotOK();
}
 
Example 8
Source File: InputNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_input_name_contains_spaces() throws Exception {
    final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(aTableViewer(),
            messageManager, new EMFDataBindingContext(), refactorOperationFactory, progressService);

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContractInput().build());
    final IStatus status = convertStrategy
            .validateAfterGet("first name");

    assertThat(status).isNotOK();
}
 
Example 9
Source File: InputNameObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_input_name_startsWith_an_uppercase() throws Exception {
    final InputNameObservableEditingSupport editingSupport = new InputNameObservableEditingSupport(aTableViewer(),
            messageManager, new EMFDataBindingContext(), refactorOperationFactory, progressService);

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(aContractInput().build());
    final IStatus status = convertStrategy
            .validateAfterGet("Firstname");

    assertThat(status).isNotOK();
}
 
Example 10
Source File: DescriptionObservableEditingSupportTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_fails_validation_if_input_description_is_too_above_255_chars() throws Exception {
    final DescriptionObservableEditingSupport editingSupport = new DescriptionObservableEditingSupport(aTableViewer(), null,
            new EMFDataBindingContext());

    final UpdateValueStrategy convertStrategy = editingSupport.targetToModelConvertStrategy(null);
    final IStatus status = convertStrategy
            .validateAfterGet("kjdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfgdfgdfkgdfkjghdfkjghdfkjghdfkjghdfkjghdfkjghdfkjghurtyuizeryueiz ueizryueizry ueizryezuirydddddddddddddddddddddddddddddddddddddddddfgdfgdfghdfkjghkjdfhgkjdfhgkjdfghkjdfghkjdfghkjhkjhkjdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd");

    assertThat(status).isNotOK();
}