use of org.kie.workbench.common.dmn.api.definition.model.Invocation in project kie-wb-common by kiegroup.
the class InvocationPropertyConverterTest method testDMNFromWB.
@Test
public void testDMNFromWB() {
final Invocation wb = new Invocation();
final LiteralExpression literalExpression = new LiteralExpression();
literalExpression.getComponentWidths().set(0, 200.0);
literalExpression.getId().setValue(EXPRESSION_UUID);
wb.getId().setValue(INVOCATION_UUID);
wb.getDescription().setValue(INVOCATION_DESCRIPTION);
wb.setTypeRef(new org.kie.workbench.common.dmn.api.property.dmn.QName(org.kie.workbench.common.dmn.api.property.dmn.QName.NULL_NS_URI, INVOCATION_QNAME_LOCALPART));
wb.setExpression(literalExpression);
final org.kie.dmn.model.api.Invocation dmn = InvocationPropertyConverter.dmnFromWB(wb, componentWidthsConsumer);
assertThat(dmn).isNotNull();
assertThat(dmn.getId()).isNotNull();
assertThat(dmn.getId()).isEqualTo(INVOCATION_UUID);
assertThat(dmn.getDescription()).isNotNull();
assertThat(dmn.getDescription()).isEqualTo(INVOCATION_DESCRIPTION);
assertThat(dmn.getTypeRef()).isNotNull();
assertThat(dmn.getTypeRef().getLocalPart()).isEqualTo(INVOCATION_QNAME_LOCALPART);
assertThat(dmn.getExpression()).isNotNull();
assertThat(dmn.getExpression().getId()).isEqualTo(EXPRESSION_UUID);
verify(componentWidthsConsumer).accept(componentWidthsCaptor.capture());
final ComponentWidths componentWidths = componentWidthsCaptor.getValue();
assertThat(componentWidths).isNotNull();
assertThat(componentWidths.getDmnElementRef().getLocalPart()).isEqualTo(EXPRESSION_UUID);
assertThat(componentWidths.getWidths().size()).isEqualTo(literalExpression.getRequiredComponentWidthCount());
assertThat(componentWidths.getWidths().get(0)).isEqualTo(200.0);
}
use of org.kie.workbench.common.dmn.api.definition.model.Invocation in project kie-wb-common by kiegroup.
the class InvocationGrid method doAfterSelectionChange.
@Override
public void doAfterSelectionChange(final int uiRowIndex, final int uiColumnIndex) {
if (hasAnyHeaderCellSelected() || hasMultipleCellsSelected()) {
super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
return;
}
if (uiColumnIndex == InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX) {
if (getExpression().get().isPresent()) {
final Invocation invocation = getExpression().get().get();
fireDomainObjectSelectionEvent(invocation.getBinding().get(uiRowIndex).getVariable());
return;
}
}
super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
}
use of org.kie.workbench.common.dmn.api.definition.model.Invocation in project kie-wb-common by kiegroup.
the class AddParameterBindingCommandTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.invocation = new Invocation();
this.binding = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name("p" + invocation.getBinding().size()));
this.binding.setParameter(parameter);
this.uiModel = new BaseGridData(false);
this.uiModelRow = new BaseGridRow();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
this.uiModelMapper = new InvocationUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(invocation), () -> false, () -> expressionEditorDefinitions, listSelector, 0);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiNameColumn).getIndex();
doReturn(2).when(uiExpressionEditorColumn).getIndex();
doReturn(uiModel).when(gridWidget).getModel();
doReturn(Optional.empty()).when(expressionEditorDefinitions).getExpressionEditorDefinition(any(Optional.class));
}
use of org.kie.workbench.common.dmn.api.definition.model.Invocation in project kie-wb-common by kiegroup.
the class DeleteParameterBindingCommandTest method setup.
@Before
public void setup() {
this.invocation = new Invocation();
this.binding = makeBinding("p" + invocation.getBinding().size());
this.invocation.getBinding().add(binding);
this.uiModel = new BaseGridData(false);
this.uiGridRow = new BaseGridRow();
this.uiModel.appendRow(uiGridRow);
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiNameColumn).getIndex();
doReturn(2).when(uiExpressionEditorColumn).getIndex();
}
use of org.kie.workbench.common.dmn.api.definition.model.Invocation in project kie-wb-common by kiegroup.
the class ExpressionPropertyConverterTest method testDMNFromWB_InvocationConversion.
@Test
public void testDMNFromWB_InvocationConversion() {
final Invocation wb = new Invocation();
final List<Double> wbComponentWidths = wb.getComponentWidths();
wbComponentWidths.set(0, 100.0);
wbComponentWidths.set(1, 200.0);
wbComponentWidths.set(2, 300.0);
wb.getId().setValue(EXPRESSION_UUID);
assertDMNFromWBConversion(wb, TInvocation.class, 100.0, 200.0, 300.0);
}
Aggregations