Search in sources :

Example 16 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class GuidedDecisionTableEditorServiceImplCDITest method testFunctionFromDrl.

@Test
public void testFunctionFromDrl() throws Exception {
    final Path path = getPath("rhba370/src/main/resources/com/sample/dtissuesampleproject/UseFunctionFromDrl.gdst");
    final List<ValidationMessage> validationMessages = testedService.validate(path, testedService.load(path));
    Assertions.assertThat(validationMessages).isEmpty();
}
Also used : Path(org.uberfire.backend.vfs.Path) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) Test(org.junit.Test)

Example 17 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenter method onValidate.

@Override
public void onValidate(final GuidedDecisionTableView.Presenter dtPresenter) {
    final ObservablePath path = dtPresenter.getCurrentPath();
    final GuidedDecisionTable52 model = dtPresenter.getModel();
    service.call(new RemoteCallback<List<ValidationMessage>>() {

        @Override
        public void callback(final List<ValidationMessage> results) {
            if (results == null || results.isEmpty()) {
                notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemValidatedSuccessfully(), NotificationEvent.NotificationType.SUCCESS));
            } else {
                showValidationPopup(results);
            }
        }
    }).validate(path, model);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) List(java.util.List) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 18 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class EnumServiceImplCDITest method testValidateWrongSyntax.

@Test
public void testValidateWrongSyntax() throws Exception {
    final Path path = getPath("enums/src/main/resources/guvnor/feature/enums/personAgeWrongSyntax.enumeration");
    final List<ValidationMessage> validationMessages = enumService.validate(path);
    Assertions.assertThat(validationMessages).hasSize(3);
    Assertions.assertThat(validationMessages.stream().map(message -> message.getText()).filter(messageText -> isOneOfExpectedError(messageText)).count()).isEqualTo(3);
}
Also used : Path(org.uberfire.backend.vfs.Path) EnumService(org.drools.workbench.screens.enums.service.EnumService) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) Test(org.junit.Test) Paths(org.uberfire.backend.server.util.Paths) List(java.util.List) After(org.junit.After) Assertions(org.assertj.core.api.Assertions) CDITestSetup(org.guvnor.test.CDITestSetup) Path(org.uberfire.backend.vfs.Path) NotThreadSafe(javax.annotation.concurrent.NotThreadSafe) Before(org.junit.Before) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) Test(org.junit.Test)

Example 19 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class DSLTextEditorServiceImpl method makeNewValidationMessage.

private ValidationMessage makeNewValidationMessage(final Object o) {
    final ValidationMessage msg = new ValidationMessage();
    msg.setLevel(Level.ERROR);
    msg.setText("Uncategorized error " + o);
    return msg;
}
Also used : ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage)

Aggregations

ValidationMessage (org.guvnor.common.services.shared.validation.model.ValidationMessage)19 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 Path (org.uberfire.backend.vfs.Path)6 List (java.util.List)3 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)3 IOException (java.io.IOException)2 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 ObservablePath (org.uberfire.backend.vfs.ObservablePath)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 StringReader (java.io.StringReader)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 NotThreadSafe (javax.annotation.concurrent.NotThreadSafe)1 Assertions (org.assertj.core.api.Assertions)1 DSLMappingParseException (org.drools.compiler.lang.dsl.DSLMappingParseException)1 DSLTokenizedMappingFile (org.drools.compiler.lang.dsl.DSLTokenizedMappingFile)1 ConnectiveConstraint (org.drools.workbench.models.datamodel.rule.ConnectiveConstraint)1 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)1 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)1