Search in sources :

Example 6 with JSITUnaryTests

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests in project kie-wb-common by kiegroup.

the class OutputClauseUnaryTestsPropertyConverterTest method testDMNFromWBWhenNonNullWithNonEmptyString.

@Test
public void testDMNFromWBWhenNonNullWithNonEmptyString() {
    final OutputClauseUnaryTests wb = new OutputClauseUnaryTests();
    wb.getText().setValue(TEXT);
    final JSITUnaryTests dmn = OutputClauseUnaryTestsPropertyConverter.dmnFromWB(wb);
    assertThat(dmn).isNotNull();
    verify(jsitUnaryTests).setText(TEXT);
}
Also used : JSITUnaryTests(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests) OutputClauseUnaryTests(org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests) Test(org.junit.Test)

Example 7 with JSITUnaryTests

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests in project kie-wb-common by kiegroup.

the class OutputClauseUnaryTestsPropertyConverterTest method testDMNFromWBWhenNonNullWithEmptyString.

@Test
public void testDMNFromWBWhenNonNullWithEmptyString() {
    final OutputClauseUnaryTests wb = new OutputClauseUnaryTests();
    wb.getText().setValue("");
    final JSITUnaryTests dmn = OutputClauseUnaryTestsPropertyConverter.dmnFromWB(wb);
    assertThat(dmn).isNull();
}
Also used : JSITUnaryTests(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests) OutputClauseUnaryTests(org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests) Test(org.junit.Test)

Example 8 with JSITUnaryTests

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests in project kie-wb-common by kiegroup.

the class OutputClauseUnaryTestsPropertyConverterTest method testDMNFromWBWhenTextIsNull.

@Test
public void testDMNFromWBWhenTextIsNull() {
    final OutputClauseUnaryTests wb = new OutputClauseUnaryTests();
    wb.setText(null);
    final JSITUnaryTests dmn = OutputClauseUnaryTestsPropertyConverter.dmnFromWB(wb);
    assertThat(dmn).isNull();
}
Also used : JSITUnaryTests(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests) OutputClauseUnaryTests(org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests) Test(org.junit.Test)

Example 9 with JSITUnaryTests

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests in project kie-wb-common by kiegroup.

the class InputClausePropertyConverter method dmnFromWB.

public static JSITInputClause dmnFromWB(final InputClause wb) {
    final JSITInputClause result = new JSITInputClause();
    result.setId(wb.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
    description.ifPresent(result::setDescription);
    final JSITLiteralExpression expression = LiteralExpressionPropertyConverter.dmnFromWB(wb.getInputExpression());
    final JSITUnaryTests inputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getInputValues());
    result.setInputExpression(expression);
    if (Objects.nonNull(inputValues) && StringUtils.nonEmpty(inputValues.getText())) {
        result.setInputValues(inputValues);
    }
    return result;
}
Also used : JSITLiteralExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression) JSITUnaryTests(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests) JSITInputClause(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputClause)

Example 10 with JSITUnaryTests

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests in project kie-wb-common by kiegroup.

the class ItemDefinitionPropertyConverter method setUnaryTests.

static void setUnaryTests(final ItemDefinition wb, final JSITItemDefinition dmn) {
    final JSITUnaryTests dmnAllowedValues = dmn.getAllowedValues();
    final Optional<UnaryTests> wbUnaryTests = ofNullable(UnaryTestsPropertyConverter.wbFromDMN(dmnAllowedValues));
    wbUnaryTests.ifPresent(unaryTests -> {
        wb.setAllowedValues(unaryTests);
        unaryTests.setParent(wb);
    });
}
Also used : JSITUnaryTests(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests) UnaryTests(org.kie.workbench.common.dmn.api.definition.model.UnaryTests) JSITUnaryTests(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests)

Aggregations

JSITUnaryTests (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITUnaryTests)12 Test (org.junit.Test)4 UnaryTests (org.kie.workbench.common.dmn.api.definition.model.UnaryTests)4 JSITLiteralExpression (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression)4 OutputClauseUnaryTests (org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests)3 QName (javax.xml.namespace.QName)2 ConstraintType (org.kie.workbench.common.dmn.api.definition.model.ConstraintType)2 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)2 RuleAnnotationClauseText (org.kie.workbench.common.dmn.api.definition.model.RuleAnnotationClauseText)2 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)2 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)2 JSITDecisionRule (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionRule)2 JSITRuleAnnotation (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRuleAnnotation)2 HashMap (java.util.HashMap)1 DecisionRule (org.kie.workbench.common.dmn.api.definition.model.DecisionRule)1 IsUnaryTests (org.kie.workbench.common.dmn.api.definition.model.IsUnaryTests)1 ItemDefinition (org.kie.workbench.common.dmn.api.definition.model.ItemDefinition)1 ExpressionLanguage (org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage)1 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)1 JSITInputClause (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputClause)1