use of org.kie.workbench.common.stunner.bpmn.definition.property.connectors.ConditionExpression in project kie-wb-common by kiegroup.
the class SequenceFlowConverter method convertEdge.
public BpmnEdge convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) {
Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class);
SequenceFlow definition = edge.getContent().getDefinition();
SequenceFlowPropertyReader p = propertyReaderFactory.of(seq);
definition.setGeneral(new BPMNGeneralSet(new Name(seq.getName()), new Documentation(p.getDocumentation())));
definition.setExecutionSet(new SequenceFlowExecutionSet(new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression())));
return BpmnEdge.of(edge, nodes.get(p.getSourceId()), p.getSourceConnection(), nodes.get(p.getTargetId()), p.getTargetConnection());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.connectors.ConditionExpression in project kie-wb-common by kiegroup.
the class ConditionalComboBoxFieldRendererTest method initWithDefinitionSet.
@Test
public void initWithDefinitionSet() throws Exception {
resetMocks();
SequenceFlow sequenceFlow = new SequenceFlow.SequenceFlowBuilder().build();
SequenceFlowExecutionSet sequenceFlowExecutionSet = sequenceFlow.getExecutionSet();
ConditionExpression conditionExpression = sequenceFlowExecutionSet.getConditionExpression();
// static mock
PowerMockito.mockStatic(ClientBindingUtils.class);
BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlow, "executionSet")).willReturn(sequenceFlowExecutionSet);
BDDMockito.given(ClientBindingUtils.getProxiedValue(sequenceFlowExecutionSet, "conditionExpression")).willReturn(conditionExpression);
// instances mock
when(conditionalComboBoxFieldDefinition.getRelatedField()).thenReturn("executionSet.conditionExpression");
when(renderingContext.getModel()).thenReturn(null);
when(renderingContext.getParentContext()).thenReturn(renderingContextParent);
when(renderingContextParent.getModel()).thenReturn(sequenceFlow);
when(adapterManager.forProperty()).thenReturn(Mockito.mock(PropertyAdapter.class));
when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn("value");
conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
verify(conditionalComboBoxFieldRenderer, never()).setReadOnly(true);
verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(false);
when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn("");
conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
verify(conditionalComboBoxFieldRenderer, times(1)).setReadOnly(true);
when(adapterManager.forProperty().getValue(conditionExpression)).thenReturn(null);
conditionalComboBoxFieldRenderer.init(renderingContext, conditionalComboBoxFieldDefinition);
verify(conditionalComboBoxFieldRenderer, atLeastOnce()).setReadOnly(true);
}
Aggregations