use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class ParametersPopoverViewImplTest method testSetParameters.
@Test
public void testSetParameters() {
final InformationItem parameter1 = new InformationItem();
final InformationItem parameter2 = new InformationItem();
parameter1.getName().setValue(PARAMETER1_NAME);
parameter2.getName().setValue(PARAMETER2_NAME);
final List<InformationItem> parameters = Arrays.asList(parameter1, parameter2);
view.setParameters(parameters);
verify(parameterView1).setName(eq(PARAMETER1_NAME));
verifyRemoveClickHandler(parameter1, parameterView1);
verifyParameterNameChangeHandler(parameter1, parameterView1);
verifyParameterTypeRefChangeHandler(parameter1, parameterView1);
verify(parameterView2).setName(eq(PARAMETER2_NAME));
verifyRemoveClickHandler(parameter2, parameterView2);
verifyParameterNameChangeHandler(parameter2, parameterView2);
verifyParameterTypeRefChangeHandler(parameter2, parameterView2);
verify(parametersContainer, times(2)).appendChild(element);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class RelationDefaultValueUtilitiesTest method testGetNewColumnNameWithDeletion.
@Test
public void testGetNewColumnNameWithDeletion() {
final InformationItem informationItem1 = new InformationItem();
relation.getColumn().add(informationItem1);
informationItem1.getName().setValue(RelationDefaultValueUtilities.getNewColumnName(relation));
assertThat(informationItem1.getName().getValue()).isEqualTo(RelationDefaultValueUtilities.PREFIX + "1");
final InformationItem informationItem2 = new InformationItem();
relation.getColumn().add(informationItem2);
informationItem2.getName().setValue(RelationDefaultValueUtilities.getNewColumnName(relation));
assertThat(informationItem2.getName().getValue()).isEqualTo(RelationDefaultValueUtilities.PREFIX + "2");
relation.getColumn().remove(informationItem1);
final InformationItem informationItem3 = new InformationItem();
relation.getColumn().add(informationItem3);
informationItem3.getName().setValue(RelationDefaultValueUtilities.getNewColumnName(relation));
assertThat(informationItem3.getName().getValue()).isEqualTo(RelationDefaultValueUtilities.PREFIX + "3");
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class InvocationDefaultValueUtilitiesTest method testGetNewParameterName.
@Test
public void testGetNewParameterName() {
final Binding binding1 = new Binding() {
{
setParameter(new InformationItem());
}
};
invocation.getBinding().add(binding1);
binding1.getParameter().getName().setValue(InvocationDefaultValueUtilities.getNewParameterName(invocation));
assertThat(binding1.getParameter().getName().getValue()).isEqualTo(InvocationDefaultValueUtilities.PREFIX + "1");
final Binding binding2 = new Binding() {
{
setParameter(new InformationItem());
}
};
invocation.getBinding().add(binding2);
binding2.getParameter().getName().setValue(InvocationDefaultValueUtilities.getNewParameterName(invocation));
assertThat(binding2.getParameter().getName().getValue()).isEqualTo(InvocationDefaultValueUtilities.PREFIX + "2");
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class InvocationDefaultValueUtilitiesTest method testGetNewParameterNameWithExistingParameters.
@Test
public void testGetNewParameterNameWithExistingParameters() {
final Binding binding1 = new Binding() {
{
setParameter(new InformationItem());
}
};
invocation.getBinding().add(binding1);
binding1.getParameter().getName().setValue("binding");
final Binding binding2 = new Binding() {
{
setParameter(new InformationItem());
}
};
invocation.getBinding().add(binding2);
binding2.getParameter().getName().setValue(InvocationDefaultValueUtilities.getNewParameterName(invocation));
assertThat(binding2.getParameter().getName().getValue()).isEqualTo(InvocationDefaultValueUtilities.PREFIX + "1");
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class BaseContextUIModelMapperTest method setup.
@SuppressWarnings("unchecked")
public void setup(final boolean isOnlyVisualChangeAllowedSupplier) {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
when(uiRowNumberColumn.getIndex()).thenReturn(0);
when(uiNameColumn.getIndex()).thenReturn(1);
when(uiExpressionEditorColumn.getIndex()).thenReturn(2);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionEditor.getExpression()).thenReturn(() -> Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
when(undefinedExpressionEditorDefinition.getModelClass()).thenReturn(Optional.empty());
when(undefinedExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(undefinedExpressionEditor));
this.context = new Context();
this.context.getContextEntry().add(new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("ii1"));
}
});
}
});
this.context.getContextEntry().add(new ContextEntry() {
{
setExpression(new LiteralExpression());
}
});
this.mapper = getMapper(isOnlyVisualChangeAllowedSupplier);
this.cellValueSupplier = Optional::empty;
}
Aggregations