use of org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue in project kie-wb-common by kiegroup.
the class GenericServiceTaskPropertyReaderTest method getGenericServiceTask.
@Test
public void getGenericServiceTask() {
GenericServiceTaskValue task = reader.getGenericServiceTask();
assertEquals("Java", task.getServiceImplementation());
assertEquals("serviceOperation", task.getServiceOperation());
assertEquals("serviceInterface", task.getServiceInterface());
assertEquals("inMessageStructure", task.getInMessageStructure());
assertEquals("outMessageStructure", task.getOutMessagetructure());
assertEquals(SLA_DUE_DATE_CDATA, reader.getSLADueDate());
assertEquals(false, reader.isAsync());
assertEquals(true, reader.isAdHocAutostart());
assertNotNull(reader.getOnEntryAction());
assertNotNull(reader.getOnExitAction());
assertNotNull(reader.getAssignmentsInfo());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue in project kie-wb-common by kiegroup.
the class GenericServiceTaskPropertyReader method getGenericServiceTask.
public GenericServiceTaskValue getGenericServiceTask() {
GenericServiceTaskValue value = new GenericServiceTaskValue();
final String implementation = Optional.ofNullable(CustomAttribute.serviceImplementation.of(task).get()).filter(StringUtils::nonEmpty).orElseGet(() -> task.getImplementation());
value.setServiceImplementation(getServiceImplementation(implementation));
final String operation = Optional.ofNullable(CustomAttribute.serviceOperation.of(task).get()).filter(StringUtils::nonEmpty).orElseGet(() -> Optional.ofNullable(task.getOperationRef()).map(Operation::getName).orElse(null));
value.setServiceOperation(operation);
value.setInMessageStructure(Optional.ofNullable(task.getOperationRef()).map(Operation::getInMessageRef).map(Message::getItemRef).map(ItemDefinition::getStructureRef).orElse(null));
value.setOutMessagetructure(Optional.ofNullable(task.getOperationRef()).map(Operation::getOutMessageRef).map(Message::getItemRef).map(ItemDefinition::getStructureRef).orElse(null));
final String serviceInterface = Optional.ofNullable(CustomAttribute.serviceInterface.of(task).get()).filter(StringUtils::nonEmpty).orElseGet(() -> Optional.ofNullable(task.getOperationRef()).map(Operation::eContainer).filter(container -> container instanceof Interface).map(container -> (Interface) container).map(Interface::getName).orElse(null));
value.setServiceInterface(serviceInterface);
return value;
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue in project kie-wb-common by kiegroup.
the class GenericServiceTaskEditorWidget method onChange.
protected void onChange() {
GenericServiceTaskValue newValue = new GenericServiceTaskValue();
newValue.setServiceOperation(serviceOperation.getValue());
newValue.setServiceInterface(serviceInterface.getValue());
newValue.setServiceImplementation(implementation.getValue());
setValue(newValue, true);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue in project kie-wb-common by kiegroup.
the class GenericServiceTaskEditorWidgetTest method setValue.
@Test
public void setValue() {
GenericServiceTaskValue value = new GenericServiceTaskValue();
value.setServiceImplementation("JAVA");
value.setServiceInterface("AAAAAAAAAAAAAA");
value.setServiceOperation("BBBBBBBBBBBBBB");
widget.setValue(value);
assertEquals(value, widget.getValue());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue in project kie-wb-common by kiegroup.
the class GenericServiceTaskEditorWidgetTest method setUp.
@Before
public void setUp() throws Exception {
setFieldValue(widget, "implementation", implementation);
setFieldValue(widget, "serviceInterface", serviceInterface);
setFieldValue(widget, "serviceOperation", serviceOperation);
setFieldValue(widget, "value", new GenericServiceTaskValue());
doCallRealMethod().when(widget).setReadOnly(any(boolean.class));
doCallRealMethod().when(widget).getValue();
doCallRealMethod().when(widget).onChange();
doCallRealMethod().when(widget).init();
doCallRealMethod().when(widget).clearSelect(any(Select.class));
doCallRealMethod().when(widget).onImplementationChange(any(Event.class));
doCallRealMethod().when(widget).onServiceInterfaceChange(any(Event.class));
doCallRealMethod().when(widget).onServiceOperationChange(any(Event.class));
doCallRealMethod().when(widget).getImplementationOptions();
doCallRealMethod().when(widget).setServiceImplementationOptions(anyList());
doCallRealMethod().when(widget).setValue(any(GenericServiceTaskValue.class));
doCallRealMethod().when(widget).setValue(any(GenericServiceTaskValue.class), any(boolean.class));
doCallRealMethod().when(widget).addValueChangeHandler(any(ValueChangeHandler.class));
when(implementation.getOptions()).thenReturn(optionsCollection);
when(optionsCollection.getLength()).thenReturn(0);
when(select.getOptions()).thenReturn(optionsCollection);
when(optionsCollection.getLength()).thenReturn(0);
}
Aggregations