use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DecisionNavigatorNestedItemFactoryTest method testMakeOnClickCommand.
@Test
public void testMakeOnClickCommand() {
final EditExpressionEvent expressionEvent = mock(EditExpressionEvent.class);
final CanvasHandler canvasHandler = mock(CanvasHandler.class);
final CanvasSelectionEvent event = mock(CanvasSelectionEvent.class);
final String uuid = "uuid";
when(dmnGraphUtils.getCanvasHandler()).thenReturn(canvasHandler);
doReturn(event).when(factory).makeCanvasSelectionEvent(canvasHandler, uuid);
doReturn(expressionEvent).when(factory).makeEditExpressionEvent(node);
factory.makeOnClickCommand(node, uuid).execute();
verify(canvasSelectionEvent).fire(event);
verify(editExpressionEvent).fire(expressionEvent);
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DecisionNavigatorObserverTest method testSetActiveParent.
@Test
public void testSetActiveParent() {
final EditExpressionEvent event = makeEditExpressionEvent();
observer.init(presenter);
observer.setActiveParent(event);
verify(treePresenter).setActiveParentUUID(uuid);
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DMNEditBusinessKnowledgeModelToolboxActionTest method testActionSetExpression.
@Test
public void testActionSetExpression() {
tested.onMouseClick(canvasHandler, E_UUID, mouseClickEvent);
final ArgumentCaptor<EditExpressionEvent> eventCaptor = ArgumentCaptor.forClass(EditExpressionEvent.class);
verify(editExpressionEvent, times(1)).fire(eventCaptor.capture());
final EditExpressionEvent editExprEvent = eventCaptor.getValue();
final HasExpression hasExpression = editExprEvent.getHasExpression();
Assertions.assertThatThrownBy(() -> hasExpression.setExpression(new DecisionTable())).isInstanceOf(UnsupportedOperationException.class).hasMessage("It is not possible to set the EncapsulatedLogic of a BusinessKnowledgeModel.");
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DMNEditBusinessKnowledgeModelToolboxActionTest method testActionWhenIsReadOnlyDiagram.
@Test
public void testActionWhenIsReadOnlyDiagram() {
when(readOnlyProvider.isReadOnlyDiagram()).thenReturn(true);
final ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, mouseClickEvent);
assertEquals(tested, cascade);
final ArgumentCaptor<EditExpressionEvent> eventCaptor = ArgumentCaptor.forClass(EditExpressionEvent.class);
verify(editExpressionEvent, times(1)).fire(eventCaptor.capture());
final EditExpressionEvent editExprEvent = eventCaptor.getValue();
assertEquals(E_UUID, editExprEvent.getNodeUUID());
final HasExpression hasExpression = editExprEvent.getHasExpression();
assertEquals(bkm.getEncapsulatedLogic(), hasExpression.getExpression());
assertEquals(bkm, hasExpression.asDMNModelInstrumentedBase());
assertFalse(hasExpression.isClearSupported());
assertEquals(bkm, editExprEvent.getHasName().get());
assertEquals(session, editExprEvent.getSession());
assertTrue(editExprEvent.isOnlyVisualChangeAllowed());
}
use of org.kie.workbench.common.dmn.client.events.EditExpressionEvent in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxActionTest method testActionWhenIsReadOnlyDiagram.
@Test
public void testActionWhenIsReadOnlyDiagram() {
when(readOnlyProvider.isReadOnlyDiagram()).thenReturn(true);
final MouseClickEvent event = mock(MouseClickEvent.class);
final ToolboxAction<AbstractCanvasHandler> cascade = tested.onMouseClick(canvasHandler, E_UUID, event);
assertEquals(tested, cascade);
final ArgumentCaptor<EditExpressionEvent> eventCaptor = ArgumentCaptor.forClass(EditExpressionEvent.class);
verify(editExpressionEvent, times(1)).fire(eventCaptor.capture());
final EditExpressionEvent editExprEvent = eventCaptor.getValue();
assertEquals(E_UUID, editExprEvent.getNodeUUID());
assertEquals(decision, editExprEvent.getHasExpression());
assertEquals(decision, editExprEvent.getHasName().get());
assertEquals(session, editExprEvent.getSession());
assertTrue(editExprEvent.isOnlyVisualChangeAllowed());
}
Aggregations