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);
}
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());
}
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());
}
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);
}
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;
}
Aggregations