use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader in project kie-wb-common by kiegroup.
the class BaseTaskConverterTest method convertGenericServiceTask.
@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(any(), 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);
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GenericServiceTaskPropertyReader in project kie-wb-common by kiegroup.
the class BaseTaskConverter method bpmnServiceTask.
BpmnNode bpmnServiceTask(org.eclipse.bpmn2.ServiceTask task) {
Node<View<GenericServiceTask>, Edge> node = factoryManager.newNode(task.getId(), GenericServiceTask.class);
GenericServiceTask definition = node.getContent().getDefinition();
GenericServiceTaskPropertyReader p = propertyReaderFactory.of(task);
if (p == null) {
throw new NullPointerException(task.getClass().getCanonicalName());
}
definition.setGeneral(new TaskGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
definition.setExecutionSet(new GenericServiceTaskExecutionSet(new GenericServiceTaskInfo(p.getGenericServiceTask()), p.getAssignmentsInfo(), new AdHocAutostart(p.isAdHocAutostart()), new IsAsync(p.isAsync()), new IsMultipleInstance(p.isMultipleInstance()), new MultipleInstanceExecutionMode(p.isSequential()), new MultipleInstanceCollectionInput(p.getCollectionInput()), new MultipleInstanceDataInput(p.getDataInput()), new MultipleInstanceCollectionOutput(p.getCollectionOutput()), new MultipleInstanceDataOutput(p.getDataOutput()), new MultipleInstanceCompletionCondition(p.getCompletionCondition()), new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction()), new SLADueDate(p.getSLADueDate())));
node.getContent().setBounds(p.getBounds());
definition.setDimensionsSet(p.getRectangleDimensionsSet());
definition.setBackgroundSet(p.getBackgroundSet());
definition.setFontSet(p.getFontSet());
definition.setSimulationSet(p.getSimulationSet());
definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
return BpmnNode.of(node, p);
}
Aggregations