Search in sources :

Example 6 with ExpressionLanguage

use of org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage in project kie-wb-common by kiegroup.

the class BaseLiteralExpressionPropertyConverterTest method testDMNFromWB.

@Test
public void testDMNFromWB() {
    final org.kie.workbench.common.dmn.api.definition.model.ImportedValues importedValues = new org.kie.workbench.common.dmn.api.definition.model.ImportedValues();
    importedValues.setImportedElement(IMPORTED_ELEMENT);
    final org.kie.workbench.common.dmn.api.definition.model.LiteralExpression wb = new org.kie.workbench.common.dmn.api.definition.model.LiteralExpression(new Id(UUID), new Description(DESCRIPTION), BuiltInType.BOOLEAN.asQName(), new Text(TEXT), importedValues, new ExpressionLanguage(EXPRESSION_LANGUAGE));
    final LiteralExpression dmn = LiteralExpressionPropertyConverter.dmnFromWB(wb);
    assertThat(dmn.getId()).isEqualTo(UUID);
    assertThat(dmn.getDescription()).isEqualTo(DESCRIPTION);
    assertThat(dmn.getTypeRef().getNamespaceURI()).isEmpty();
    assertThat(dmn.getTypeRef().getLocalPart()).isEqualTo(BuiltInType.BOOLEAN.getName());
    assertThat(dmn.getText()).isEqualTo(TEXT);
    assertThat(dmn.getImportedValues()).isNotNull();
    assertThat(dmn.getImportedValues().getImportedElement()).isEqualTo(IMPORTED_ELEMENT);
    assertThat(dmn.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) TLiteralExpression(org.kie.dmn.model.v1_2.TLiteralExpression) IsLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression) LiteralExpression(org.kie.dmn.model.api.LiteralExpression) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) ImportedValues(org.kie.dmn.model.api.ImportedValues) TImportedValues(org.kie.dmn.model.v1_2.TImportedValues) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Test(org.junit.Test)

Example 7 with ExpressionLanguage

use of org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage in project kie-wb-common by kiegroup.

the class LiteralExpressionTest method testCopy.

@Test
public void testCopy() {
    final LiteralExpression source = new LiteralExpression(new Id(LITERAL_ID), new Description(DESCRIPTION), BuiltInType.BOOLEAN.asQName(), new Text(TEXT), null, new ExpressionLanguage(EXPRESSION_LANGUAGE));
    final LiteralExpression target = source.copy();
    assertNotNull(target);
    assertNotEquals(LITERAL_ID, target.getId());
    assertEquals(DESCRIPTION, target.getDescription().getValue());
    assertEquals(BuiltInType.BOOLEAN.asQName(), target.getTypeRef());
    assertEquals(TEXT, target.getText().getValue());
    assertNull(target.getImportedValues());
    assertEquals(EXPRESSION_LANGUAGE, target.getExpressionLanguage().getValue());
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) Test(org.junit.Test)

Example 8 with ExpressionLanguage

use of org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage in project kie-wb-common by kiegroup.

the class ImportedValuesTest method testCopy.

@Test
public void testCopy() {
    final ImportedValues source = new ImportedValues(NAMESPACE, new LocationURI(LOCATION_URI), IMPORT_TYPE, IMPORTED_ELEMENT, new ExpressionLanguage(EXPRESSION_LANGUAGE));
    final ImportedValues target = source.copy();
    assertNotNull(target);
    assertEquals(NAMESPACE, target.getNamespace());
    assertEquals(LOCATION_URI, target.getLocationURI().getValue());
    assertEquals(IMPORT_TYPE, target.getImportType());
    assertEquals(IMPORTED_ELEMENT, target.getImportedElement());
    assertEquals(EXPRESSION_LANGUAGE, target.getExpressionLanguage().getValue());
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) Test(org.junit.Test)

Example 9 with ExpressionLanguage

use of org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage in project kie-wb-common by kiegroup.

the class LiteralExpressionPropertyConverterTest method testDMNFromWB.

@Test
public void testDMNFromWB() {
    when(wb.getId()).thenReturn(new Id(UUID));
    when(wb.getDescription()).thenReturn(new Description(DESCRIPTION));
    when(wb.getTypeRef()).thenReturn(new QName(KIE.getUri(), TYPE_REF, KIE.getPrefix()));
    when(wb.getText()).thenReturn(new Text(TEXT));
    when(wb.getExpressionLanguage()).thenReturn(new ExpressionLanguage(EXPRESSION_LANGUAGE));
    final JSITLiteralExpression result = LiteralExpressionPropertyConverter.dmnFromWB(wb);
    verify(result).setId(UUID);
    verify(result).setDescription(DESCRIPTION);
    verify(result).setTypeRef("{" + KIE.getUri() + "}" + TYPE_REF);
    verify(result).setText(TEXT);
    verify(result).setExpressionLanguage(EXPRESSION_LANGUAGE);
}
Also used : JSITLiteralExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) Test(org.junit.Test)

Example 10 with ExpressionLanguage

use of org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage in project kie-wb-common by kiegroup.

the class ImportedValues method copy.

public ImportedValues copy() {
    ImportedValues clonedImportedValues = new ImportedValues();
    clonedImportedValues.id = new Id();
    clonedImportedValues.namespace = namespace;
    clonedImportedValues.locationURI = Optional.ofNullable(locationURI).map(LocationURI::copy).orElse(null);
    clonedImportedValues.importType = importType;
    clonedImportedValues.importedElement = importedElement;
    clonedImportedValues.expressionLanguage = Optional.ofNullable(expressionLanguage).map(ExpressionLanguage::copy).orElse(null);
    return clonedImportedValues;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage)

Aggregations

ExpressionLanguage (org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage)12 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)10 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)8 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)8 Test (org.junit.Test)5 ImportedValues (org.kie.workbench.common.dmn.api.definition.model.ImportedValues)4 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)4 IsLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression)3 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)3 QName (javax.xml.namespace.QName)2 ConstraintType (org.kie.workbench.common.dmn.api.definition.model.ConstraintType)2 IsUnaryTests (org.kie.workbench.common.dmn.api.definition.model.IsUnaryTests)2 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)2 UnaryTests (org.kie.workbench.common.dmn.api.definition.model.UnaryTests)2 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)2 JSITImportedValues (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImportedValues)2 JSITLiteralExpression (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression)2 ImportedValues (org.kie.dmn.model.api.ImportedValues)1 LiteralExpression (org.kie.dmn.model.api.LiteralExpression)1 TImportedValues (org.kie.dmn.model.v1_2.TImportedValues)1