use of org.kie.workbench.common.stunner.bpmn.client.shape.def.SequenceFlowConnectorDef in project kie-wb-common by kiegroup.
the class BPMNShapeFactoryTest method testRegisterDelegates.
@Test
@SuppressWarnings("unchecked")
public void testRegisterDelegates() {
tested.registerDelegates();
final ArgumentCaptor<Supplier> factoryArgumentCaptor = ArgumentCaptor.forClass(Supplier.class);
verify(delegateShapeFactory, times(1)).delegate(eq(BPMNDiagramImpl.class), any(BPMNDiagramShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(NoneTask.class), any(TaskShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(UserTask.class), any(TaskShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(ScriptTask.class), any(TaskShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(BusinessRuleTask.class), any(TaskShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(StartNoneEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(StartSignalEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(StartTimerEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(StartMessageEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(StartErrorEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(StartConditionalEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(StartEscalationEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(ParallelGateway.class), any(GatewayShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(ExclusiveGateway.class), any(GatewayShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(InclusiveGateway.class), any(GatewayShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EventGateway.class), any(GatewayShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(Lane.class), any(LaneShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(ReusableSubprocess.class), any(SubprocessShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EmbeddedSubprocess.class), any(SubprocessShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EventSubprocess.class), any(SubprocessShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(AdHocSubprocess.class), any(SubprocessShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(MultipleInstanceSubprocess.class), any(SubprocessShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EndNoneEvent.class), any(EndEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EndTerminateEvent.class), any(EndEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EndErrorEvent.class), any(EndEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EndSignalEvent.class), any(EndEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EndMessageEvent.class), any(EndEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EndEscalationEvent.class), any(EndEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateTimerEvent.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateConditionalEvent.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateSignalEventCatching.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateLinkEventCatching.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateErrorEventCatching.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateMessageEventCatching.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateEscalationEvent.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateSignalEventThrowing.class), any(ThrowingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateLinkEventThrowing.class), any(ThrowingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateMessageEventThrowing.class), any(ThrowingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateEscalationEventThrowing.class), any(ThrowingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
ArgumentCaptor<SequenceFlowConnectorDef> sequenceFlowConnectorDefArgumentCaptor = ArgumentCaptor.forClass(SequenceFlowConnectorDef.class);
verify(delegateShapeFactory, times(1)).delegate(eq(StartCompensationEvent.class), any(StartEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateCompensationEvent.class), any(CatchingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(IntermediateCompensationEventThrowing.class), any(ThrowingIntermediateEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(EndCompensationEvent.class), any(EndEventShapeDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(DirectionalAssociation.class), any(AssociationConnectorDef.class), factoryArgumentCaptor.capture());
verify(delegateShapeFactory, times(1)).delegate(eq(SequenceFlow.class), sequenceFlowConnectorDefArgumentCaptor.capture(), factoryArgumentCaptor.capture());
final SequenceFlowConnectorDef sequenceFlowConnectorDef = sequenceFlowConnectorDefArgumentCaptor.getValue();
sequenceFlowConnectorDef.newFontHandler().handle(sequenceFlow, sequenceFlowView);
verify(sequenceFlowView).setTitleFontColor(BPMNTextPreferences.TEXT_FILL_COLOR);
verify(sequenceFlowView).setTitleAlpha(BPMNTextPreferences.TEXT_ALPHA);
verify(sequenceFlowView).setTitleFontFamily(BPMNTextPreferences.TEXT_FONT_FAMILY);
verify(sequenceFlowView).setTitleFontSize(BPMNTextPreferences.TEXT_FONT_SIZE);
verify(sequenceFlowView).setTitleStrokeColor(BPMNTextPreferences.TEXT_STROKE_COLOR);
verify(sequenceFlowView).setTitleStrokeWidth(BPMNTextPreferences.TEXT_STROKE_WIDTH);
verify(sequenceFlowView).setTitleStrokeAlpha(0);
final long svgFactoryCallCount = factoryArgumentCaptor.getAllValues().stream().filter(this::isSvgShapeFactory).count();
final long basicFactoryCallCount = factoryArgumentCaptor.getAllValues().stream().filter(this::isBasicShapeFactory).count();
assertEquals(43, svgFactoryCallCount, 0);
assertEquals(2, basicFactoryCallCount, 0);
}
Aggregations