use of org.kie.workbench.common.dmn.client.widgets.grid.columns.ValueAndDataTypeHeaderMetaData in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testSetDisplayNameMultipleOutputClauseWithNonEmptyValue.
@Test
@SuppressWarnings("unchecked")
public void testSetDisplayNameMultipleOutputClauseWithNonEmptyValue() {
setupGrid(makeHasNameForDecision(), 0);
final String defaultName = "default-name";
final Consumer<ValueAndDataTypeHeaderMetaData> test = (md) -> md.setValue(new Name(NAME_NEW));
addOutputClause(3);
final ArgumentCaptor<CompositeCommand> compositeCommandCaptor1 = ArgumentCaptor.forClass(CompositeCommand.class);
hasExpression.getName().setValue(defaultName);
expression.get().getOutput().get(0).setName(defaultName);
assertHeaderMetaDataTest(0, 2, test, compositeCommandCaptor1, SetHasValueCommand.class, UpdateElementPropertyCommand.class);
compositeCommandCaptor1.getValue().execute(canvasHandler);
assertThat(hasExpression.getName().getValue()).isEqualTo(NAME_NEW);
assertThat(expression.get().getOutput().get(0).getName()).isEqualTo(defaultName);
final ArgumentCaptor<CompositeCommand> compositeCommandCaptor2 = ArgumentCaptor.forClass(CompositeCommand.class);
hasExpression.getName().setValue(defaultName);
expression.get().getOutput().get(0).setName(defaultName);
assertHeaderMetaDataTest(1, 2, test, compositeCommandCaptor2, SetHasValueCommand.class);
compositeCommandCaptor2.getValue().execute(canvasHandler);
assertThat(hasExpression.getName().getValue()).isEqualTo(defaultName);
assertThat(expression.get().getOutput().get(0).getName()).isEqualTo(NAME_NEW);
final ArgumentCaptor<CompositeCommand> compositeCommandCaptor3 = ArgumentCaptor.forClass(CompositeCommand.class);
hasExpression.getName().setValue(defaultName);
expression.get().getOutput().get(1).setName(defaultName);
assertHeaderMetaDataTest(0, 3, test, compositeCommandCaptor3, SetHasValueCommand.class, UpdateElementPropertyCommand.class);
compositeCommandCaptor3.getValue().execute(canvasHandler);
assertThat(hasExpression.getName().getValue()).isEqualTo(NAME_NEW);
assertThat(expression.get().getOutput().get(1).getName()).isEqualTo(defaultName);
final ArgumentCaptor<CompositeCommand> compositeCommandCaptor4 = ArgumentCaptor.forClass(CompositeCommand.class);
hasExpression.getName().setValue(defaultName);
expression.get().getOutput().get(1).setName(defaultName);
assertHeaderMetaDataTest(1, 3, test, compositeCommandCaptor4, SetHasValueCommand.class);
compositeCommandCaptor4.getValue().execute(canvasHandler);
assertThat(hasExpression.getName().getValue()).isEqualTo(defaultName);
assertThat(expression.get().getOutput().get(0).getName()).isEqualTo(NAME_NEW);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.columns.ValueAndDataTypeHeaderMetaData in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testSetDisplayNameSingleOutputClauseWithEmptyValue.
@Test
@SuppressWarnings("unchecked")
public void testSetDisplayNameSingleOutputClauseWithEmptyValue() {
setupGrid(makeHasNameForDecision(), 0);
final Consumer<ValueAndDataTypeHeaderMetaData> test = (md) -> md.setValue(new Name());
assertHeaderMetaDataTest(0, 2, test, DeleteHasValueCommand.class, DeleteHasValueCommand.class, UpdateElementPropertyCommand.class);
compositeCommandCaptor.getValue().execute(canvasHandler);
assertThat(hasExpression.getName().getValue()).isEqualTo("");
assertThat(expression.get().getOutput().get(0).getName()).isEqualTo("");
}
use of org.kie.workbench.common.dmn.client.widgets.grid.columns.ValueAndDataTypeHeaderMetaData in project kie-wb-common by kiegroup.
the class RendererUtilsTest method testRenderHeaderContentWithNameAndDataTypeHeaderMetaData.
@Test
public void testRenderHeaderContentWithNameAndDataTypeHeaderMetaData() {
final ValueAndDataTypeHeaderMetaData metaData = mock(ValueAndDataTypeHeaderMetaData.class);
when(metaData.getTitle()).thenReturn(TITLE);
when(metaData.getTypeRef()).thenReturn(TYPE_REF);
RendererUtils.getValueAndDataTypeHeaderText(metaData, headerContext, BLOCK_WIDTH, ROW_HEIGHT);
assertHasNameAndDataTypeRendering();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.columns.ValueAndDataTypeHeaderMetaData in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testSetTypeRefSingleInputClause.
@Test
@SuppressWarnings("unchecked")
public void testSetTypeRefSingleInputClause() {
setupGrid(makeHasNameForDecision(), 0);
final QName typeRef = new QName(QName.NULL_NS_URI, BuiltInType.DATE.getName());
final Consumer<ValueAndDataTypeHeaderMetaData> test = (md) -> md.setTypeRef(typeRef);
final ArgumentCaptor<CanvasCommand> canvasCommandCaptor = ArgumentCaptor.forClass(CanvasCommand.class);
assertHeaderMetaDataTest(0, 1, test, canvasCommandCaptor, SetTypeRefCommand.class);
canvasCommandCaptor.getValue().execute(canvasHandler);
assertThat(expression.get().getInput().get(0).getInputExpression().getTypeRef()).isEqualTo(typeRef);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.columns.ValueAndDataTypeHeaderMetaData in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testSetDisplayNameSingleOutputClauseWithNonEmptyValue.
@Test
@SuppressWarnings("unchecked")
public void testSetDisplayNameSingleOutputClauseWithNonEmptyValue() {
setupGrid(makeHasNameForDecision(), 0);
final Consumer<ValueAndDataTypeHeaderMetaData> test = (md) -> md.setValue(new Name(NAME_NEW));
assertHeaderMetaDataTest(0, 2, test, SetHasValueCommand.class, SetHasValueCommand.class, UpdateElementPropertyCommand.class);
compositeCommandCaptor.getValue().execute(canvasHandler);
assertThat(hasExpression.getName()).isEqualTo(new Name(NAME_NEW));
assertThat(expression.get().getOutput().get(0).getName()).isEqualTo(NAME_NEW);
}
Aggregations