use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.
the class AddContextEntryCommandTest method testGraphCommandUndoMultipleEntriesPresent.
@Test
public void testGraphCommandUndoMultipleEntriesPresent() {
final ContextEntry firstEntry = new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("old one"));
}
});
}
};
context.getContextEntry().add(0, firstEntry);
makeCommand();
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add column and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertEquals(2, context.getContextEntry().size());
assertEquals(firstEntry, context.getContextEntry().get(0));
assertEquals(defaultResultContextEntry, context.getContextEntry().get(1));
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.
the class RemoveParameterCommandTest method testRemoveFromMiddleThenUndo.
@Test
public void testRemoveFromMiddleThenUndo() {
final InformationItem firstParameter = new InformationItem();
firstParameter.setName(new Name("first"));
function.getFormalParameter().add(0, firstParameter);
final InformationItem lastParameter = new InformationItem();
lastParameter.setName(new Name("last"));
function.getFormalParameter().add(lastParameter);
// call to get proper old index of parameter
this.command = new RemoveParameterCommand(function, parameter, canvasOperation);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add parameter and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertFormalParameters(firstParameter, lastParameter);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertFormalParameters(firstParameter, parameter, lastParameter);
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.
the class AddParameterBindingCommandTest method makeCommand.
private void makeCommand(final int uiRowIndex, final String bindingName, final DMNGridRow uiGridRow) {
final Binding rowEntry = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name(bindingName));
rowEntry.setParameter(parameter);
makeCommand(uiRowIndex, rowEntry, uiGridRow);
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.
the class DeleteParameterBindingCommandTest method makeBinding.
private Binding makeBinding(final String bindingName) {
final Binding newBinding = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name(bindingName));
newBinding.setParameter(parameter);
return newBinding;
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.
the class ExpressionEditorViewImplTest method testSetEditorDoesUpdateReturnToDRGTextWhenHasNameIsNotEmpty.
@Test
public void testSetEditorDoesUpdateReturnToDRGTextWhenHasNameIsNotEmpty() {
final String NAME = "NAME";
final Name name = new Name(NAME);
final HasName hasNameMock = mock(HasName.class);
doReturn(name).when(hasNameMock).getName();
final Optional<HasName> hasName = Optional.of(hasNameMock);
view.setExpression(NODE_UUID, hasExpression, hasName);
verify(returnToDRG).setTextContent(eq(NAME));
}
Aggregations