@Test public void convertGenericServiceTask() { org.eclipse.bpmn2.ServiceTask task = mock(org.eclipse.bpmn2.ServiceTask.class); GenericServiceTaskPropertyReader genericServiceTaskPropertyReader = mock(GenericServiceTaskPropertyReader.class); GenericServiceTask definition = new GenericServiceTask(); FeatureMap attributes = mock(FeatureMap.class); FeatureMap.Entry ruleAttr = mock(FeatureMap.Entry.class); EStructuralFeature ruleFeature = mock(EStructuralFeature.class); when(factoryManager.newNode(anyString(), eq(GenericServiceTask.class))).thenReturn(genericServiceTaskNode); when(genericServiceTaskNode.getContent()).thenReturn(genericServiceTaskContent); when(genericServiceTaskContent.getDefinition()).thenReturn(definition); when(propertyReaderFactory.of(task)).thenReturn(genericServiceTaskPropertyReader); when(task.getAnyAttribute()).thenReturn(attributes); when(attributes.stream()).thenReturn(Stream.of(ruleAttr)); when(ruleAttr.getEStructuralFeature()).thenReturn(ruleFeature); when(ruleAttr.getValue()).thenReturn("Java"); when(ruleFeature.getName()).thenReturn(CustomAttribute.serviceImplementation.name()); final BpmnNode converted = (BpmnNode) tested.convert(task).value(); assertNotEquals(converted.value(), noneTaskNode); assertEquals(converted.value(), genericServiceTaskNode); }
@Override public Result<BpmnNode> convert(org.eclipse.bpmn2.Task task) { return Match.of(Task.class, BpmnNode.class) .when(org.eclipse.bpmn2.BusinessRuleTask.class, this::businessRuleTask) .when(org.eclipse.bpmn2.ScriptTask.class, this::scriptTask) .when(org.eclipse.bpmn2.UserTask.class, this::userTask) .when(org.eclipse.bpmn2.ServiceTask.class, this::serviceTaskResolver) .whenExactly(org.eclipse.bpmn2.impl.TaskImpl.class, this::defaultTaskResolver) .missing(ManualTask.class) .missing(SendTask.class) .missing(ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); }
BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.Task task) { return Match.of(Task.class, BpmnNode.class) .when(org.eclipse.bpmn2.BusinessRuleTask.class, this::businessRuleTask) .when(org.eclipse.bpmn2.ScriptTask.class, this::scriptTask) .when(org.eclipse.bpmn2.UserTask.class, this::userTask) .when(org.eclipse.bpmn2.ServiceTask.class, this::serviceTaskResolver) .whenExactly(org.eclipse.bpmn2.impl.TaskImpl.class, this::defaultTaskResolver) .missing(ManualTask.class) .missing(SendTask.class) .missing(ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } }
BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.Task task) { return Match.of(Task.class, BpmnNode.class) .when(org.eclipse.bpmn2.BusinessRuleTask.class, this::businessRuleTask) .when(org.eclipse.bpmn2.ScriptTask.class, this::scriptTask) .when(org.eclipse.bpmn2.UserTask.class, this::userTask) .when(org.eclipse.bpmn2.ServiceTask.class, this::serviceTaskResolver) .whenExactly(org.eclipse.bpmn2.impl.TaskImpl.class, this::defaultTaskResolver) .missing(ManualTask.class) .missing(SendTask.class) .missing(ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
                             Mode mode); }
BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.Task task) { return Match.of(Task.class, BpmnNode.class) .when(org.eclipse.bpmn2.BusinessRuleTask.class, this::businessRuleTask) .when(org.eclipse.bpmn2.ScriptTask.class, this::scriptTask) .when(org.eclipse.bpmn2.UserTask.class, this::userTask) .when(org.eclipse.bpmn2.ServiceTask.class, this::serviceTaskResolver) .whenExactly(org.eclipse.bpmn2.impl.TaskImpl.class, this::defaultTaskResolver) .missing(ManualTask.class) .missing(SendTask.class) .missing(ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
                             Mode mode); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.Task task); }
BaseTaskConverter extends AbstractConverter implements NodeConverter<Task> { @Override public Result<BpmnNode> convert(org.eclipse.bpmn2.Task task) { return Match.of(Task.class, BpmnNode.class) .when(org.eclipse.bpmn2.BusinessRuleTask.class, this::businessRuleTask) .when(org.eclipse.bpmn2.ScriptTask.class, this::scriptTask) .when(org.eclipse.bpmn2.UserTask.class, this::userTask) .when(org.eclipse.bpmn2.ServiceTask.class, this::serviceTaskResolver) .whenExactly(org.eclipse.bpmn2.impl.TaskImpl.class, this::defaultTaskResolver) .missing(ManualTask.class) .missing(SendTask.class) .missing(ReceiveTask.class) .orElse(this::defaultTaskResolver) .inputDecorator(BPMNElementDecorators.flowElementDecorator()) .outputDecorator(BPMNElementDecorators.bpmnNodeDecorator()) .mode(getMode()) .apply(task); } BaseTaskConverter(TypedFactoryManager factoryManager, PropertyReaderFactory propertyReaderFactory,
                             Mode mode); @Override Result<BpmnNode> convert(org.eclipse.bpmn2.Task task);  }