use of org.kie.workbench.common.stunner.bpmn.definition.property.common.ConditionExpression in project kie-wb-common by kiegroup.
the class IntermediateCatchEventConverterTest method setUp.
@Before
public void setUp() {
Event boundaryEvent = bpmn2.createBoundaryEvent();
boundaryEventPropertyWriter = spy(new BoundaryEventPropertyWriter((BoundaryEvent) spy(boundaryEvent), new FlatVariableScope(), new HashSet<>()));
// when(boundaryEventPropertyWriter.getFlowElement()).thenReturn(spy(FlowElement.class));
Event catchEvent = bpmn2.createIntermediateCatchEvent();
catchEventPropertyWriter = spy(new CatchEventPropertyWriter((CatchEvent) spy(catchEvent), new FlatVariableScope(), new HashSet<>()));
propertyWriterFactory = spy(PropertyWriterFactory.class);
when(propertyWriterFactory.of(any(BoundaryEvent.class))).thenReturn(boundaryEventPropertyWriter);
when(propertyWriterFactory.of(any(CatchEvent.class))).thenReturn(catchEventPropertyWriter);
generalSet = new BPMNGeneralSet(NAME, DOCUMENTATION);
assignmentsInfo = new AssignmentsInfo(ASSIGNMENTS_INFO);
dataIOSet = new DataIOSet(assignmentsInfo);
advancedData = new AdvancedData();
slaDueDate = mock(SLADueDate.class);
errorRef = mock(ErrorRef.class);
signalRef = mock(SignalRef.class);
linkRef = mock(LinkRef.class);
timerSettingsValue = mock(TimerSettingsValue.class);
timerSettings = new TimerSettings(timerSettingsValue);
messageRef = mock(MessageRef.class);
scriptTypeValue = mock(ScriptTypeValue.class);
conditionExpression = new ConditionExpression(scriptTypeValue);
escalationRef = mock(EscalationRef.class);
tested = spy(new IntermediateCatchEventConverter(propertyWriterFactory));
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.common.ConditionExpression in project kie-wb-common by kiegroup.
the class ConditionalComboBoxFieldRendererTest method initWithDefinitionSet.
@Test
public void initWithDefinitionSet() throws Exception {
resetMocks();
SequenceFlow sequenceFlow = new SequenceFlow();
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);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.common.ConditionExpression in project kie-wb-common by kiegroup.
the class SequenceFlowConverter method convertEdge.
@Override
public Result<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(p.getName()), new Documentation(p.getDocumentation())));
definition.setExecutionSet(new SequenceFlowExecutionSet(new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression())));
return result(nodes, edge, p, "Sequence Flow ignored from " + p.getSourceId() + " to " + p.getTargetId(), MarshallingMessageKeys.sequenceFlowIgnored);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.common.ConditionExpression in project kie-wb-common by kiegroup.
the class EventPropertyReader method getConditionExpression.
public static ConditionExpression getConditionExpression(ConditionalEventDefinition conditionalEvent) {
if (conditionalEvent.getCondition() instanceof FormalExpression) {
FormalExpression formalExpression = (FormalExpression) conditionalEvent.getCondition();
String language = Scripts.scriptLanguageFromUri(formalExpression.getLanguage(), Scripts.LANGUAGE.DROOLS.language());
String script = formalExpression.getBody();
return new ConditionExpression(new ScriptTypeValue(language, script));
} else {
return new ConditionExpression(new ScriptTypeValue(Scripts.LANGUAGE.DROOLS.language(), ""));
}
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.common.ConditionExpression in project kie-wb-common by kiegroup.
the class BaseEventPropertyReaderTest method testGetConditionExpressionNotConfigured.
@Test
public void testGetConditionExpressionNotConfigured() {
ConditionalEventDefinition eventDefinition = mock(ConditionalEventDefinition.class);
assertEquals(new ConditionExpression(new ScriptTypeValue(Scripts.LANGUAGE.DROOLS.language(), "")), EventPropertyReader.getConditionExpression(eventDefinition));
}
Aggregations