Search in sources :

Example 1 with GenericServiceTaskValue

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());
}
Also used : GenericServiceTaskValue(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue) Test(org.junit.Test)

Example 2 with GenericServiceTaskValue

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;
}
Also used : Interface(org.eclipse.bpmn2.Interface) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) CustomElement(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.CustomElement) ServiceTask(org.eclipse.bpmn2.ServiceTask) BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) Message(org.eclipse.bpmn2.Message) Optional(java.util.Optional) Operation(org.eclipse.bpmn2.Operation) CustomAttribute(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.CustomAttribute) StringUtils(org.kie.workbench.common.stunner.core.util.StringUtils) DefinitionResolver(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver) GenericServiceTaskValue(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue) GenericServiceTaskValue(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) Operation(org.eclipse.bpmn2.Operation) Interface(org.eclipse.bpmn2.Interface)

Example 3 with GenericServiceTaskValue

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);
}
Also used : GenericServiceTaskValue(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue)

Example 4 with GenericServiceTaskValue

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());
}
Also used : GenericServiceTaskValue(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue) Test(org.junit.Test) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest)

Example 5 with GenericServiceTaskValue

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);
}
Also used : GenericServiceTaskValue(org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue) Select(org.jboss.errai.common.client.dom.Select) Event(org.jboss.errai.common.client.dom.Event) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) Before(org.junit.Before)

Aggregations

GenericServiceTaskValue (org.kie.workbench.common.stunner.bpmn.definition.property.service.GenericServiceTaskValue)10 Test (org.junit.Test)4 Before (org.junit.Before)3 ServiceTask (org.eclipse.bpmn2.ServiceTask)2 ReflectionUtilsTest (org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest)2 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 Optional (java.util.Optional)1 Interface (org.eclipse.bpmn2.Interface)1 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)1 Message (org.eclipse.bpmn2.Message)1 Operation (org.eclipse.bpmn2.Operation)1 BPMNDiagram (org.eclipse.bpmn2.di.BPMNDiagram)1 Event (org.jboss.errai.common.client.dom.Event)1 Select (org.jboss.errai.common.client.dom.Select)1 CustomAttribute (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.CustomAttribute)1 CustomElement (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.CustomElement)1 GenericServiceTaskPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.GenericServiceTaskPropertyWriter)1 DefinitionResolver (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver)1 GenericServiceTask (org.kie.workbench.common.stunner.bpmn.definition.GenericServiceTask)1 AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)1