Search in sources :

Example 11 with DataObject

use of org.kie.workbench.common.stunner.bpmn.definition.DataObject in project kie-wb-common by kiegroup.

the class VariableProviderTest method testViewAndContent.

@Test
public void testViewAndContent() {
    Node<View<DataObject>, ?> dataObjectNode;
    DataObject dataObject = new DataObject();
    dataObject.getGeneral().getDocumentation().setValue("doc");
    dataObject.setName(new Name("name"));
    dataObject.setType(new DataObjectType(new DataObjectTypeValue("name")));
    dataObjectNode = new NodeImpl<>(UUID.uuid());
    dataObjectNode.setContent(dataObjectView);
    when(dataObjectView.getDefinition()).thenReturn(dataObject);
    boolean isBPMNDefinition = ((VariablesProvider) provider).isBPMNDefinition(dataObjectNode);
    assertTrue(" Must be a BPMN Definition", isBPMNDefinition);
    Node<View<Object>, ?> objectNode = new NodeImpl<>(UUID.uuid());
    objectNode.setContent(otherView);
    when(otherView.getDefinition()).thenReturn(new Object());
    isBPMNDefinition = ((VariablesProvider) provider).isBPMNDefinition(objectNode);
    assertFalse(" Must not be a BPMN Definition", isBPMNDefinition);
    Node<Element, ?> objectNode2 = new NodeImpl<>(UUID.uuid());
    Element someElement = mock(Element.class);
    objectNode2.setContent(someElement);
    isBPMNDefinition = ((VariablesProvider) provider).isBPMNDefinition(objectNode2);
    assertFalse(" Must not be a BPMN Definition", isBPMNDefinition);
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Element(org.kie.workbench.common.stunner.core.graph.Element) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) DataObjectTypeValue(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue) DataObjectType(org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType) Test(org.junit.Test)

Example 12 with DataObject

use of org.kie.workbench.common.stunner.bpmn.definition.DataObject in project kie-wb-common by kiegroup.

the class AssignmentsEditorWidgetTest method testDataObjectsNewLine.

@Test
public void testDataObjectsNewLine() {
    DataObject dataObject = new DataObject();
    dataObject.getName().setValue("Data\nObject");
    String doNameFilter = widget.dataObjectToProcessVariableFormat(dataObject);
    assertEquals(doNameFilter, "DataObject:Object");
}
Also used : DataObject(org.kie.workbench.common.stunner.bpmn.definition.DataObject) Mockito.anyString(org.mockito.Mockito.anyString) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) AssignmentBaseTest(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentBaseTest) Test(org.junit.Test)

Aggregations

DataObject (org.kie.workbench.common.stunner.bpmn.definition.DataObject)12 Test (org.junit.Test)6 DataObjectType (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType)6 DataObjectTypeValue (org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectTypeValue)6 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)5 Element (org.kie.workbench.common.stunner.core.graph.Element)4 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)3 ArrayList (java.util.ArrayList)2 DataObjectPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DataObjectPropertyWriter)2 HashMap (java.util.HashMap)1 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 PropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter)1 TextAnnotationPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.TextAnnotationPropertyWriter)1 DataObjectPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.DataObjectPropertyReader)1 AssignmentBaseTest (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentBaseTest)1 AdHocSubprocess (org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess)1 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)1 BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)1 EmbeddedSubprocess (org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess)1