use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.
the class DataObjectTest method setType.
@Test
public void setType() {
DataObjectType type = new DataObjectType(new DataObjectTypeValue(this.getClass().getSimpleName()));
dataObject.setType(type);
assertEquals(type, dataObject.getType());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.
the class ArtifactsConverterTest method toDataObjectElement.
@Test
public void toDataObjectElement() {
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);
when(propertyWriterFactory.of(any(org.eclipse.bpmn2.DataObjectReference.class))).thenReturn(dataObjectWriter);
artifactsConverter = new ArtifactsConverter(propertyWriterFactory);
PropertyWriter propertyWriter = artifactsConverter.toElement(((NodeImpl) dataObjectNode));
verify(dataObjectWriter).setName(NAME);
verify(dataObjectWriter).setType(NAME);
verify(dataObjectWriter).setAbsoluteBounds(dataObjectNode);
assertEquals(dataObjectWriter, propertyWriter);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.
the class AssignmentsEditorWidgetProcessVariablesTest method testGetProcessVariableFromDataObjects.
@Test
public void testGetProcessVariableFromDataObjects() {
DataObject dataObject = new DataObject();
dataObject.getGeneral().getDocumentation().setValue("doc");
dataObject.setName(new Name("name"));
dataObject.setType(new DataObjectType(new DataObjectTypeValue("com.myType.dataObject")));
final String uuid = UUID.uuid();
when(dataObjectNode.getUUID()).thenReturn("uuid");
when(dataObjectNode.getContent()).thenReturn(dataObjectView);
when(dataObjectView.getDefinition()).thenReturn(dataObject);
graphNodes.clear();
graphNodes.add(dataObjectNode);
graphNodes.add(parentNode);
when(parentNodeView.getDefinition()).thenReturn(dataObjectNode);
when(dataObjectNode.getUUID()).thenReturn("rootId");
createWidget();
assertEquals(dataObject.getName().getValue() + ":" + dataObject.getType().getValue().getType(), widget.getProcessVariables());
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.
the class DataObjectTest method testNotEquals.
@Test
public void testNotEquals() {
DataObject dataObject1 = new DataObject();
DataObject dataObject2 = new DataObject();
dataObject1.setName(new Name("dataObject1"));
dataObject2.setName(new Name("dataObject2"));
// Test Name
assertNotEquals(dataObject1, dataObject2);
// Reset
dataObject2.setName(new Name("dataObject1"));
assertEquals(dataObject1, dataObject2);
// Test Type
DataObjectType dataObjectType = new DataObjectType();
dataObjectType.setValue(new DataObjectTypeValue("someType"));
dataObject2.setType(dataObjectType);
assertNotEquals(dataObject1, dataObject2);
// Reset
dataObject2.setType(new DataObjectType());
assertEquals(dataObject1, dataObject2);
// Test General Set
BPMNGeneralSet generalSet = new BPMNGeneralSet();
generalSet.setName(new Name("someName"));
dataObject2.setGeneral(generalSet);
assertNotEquals(dataObject1, dataObject2);
// Reset
dataObject2.setGeneral(new BPMNGeneralSet());
assertEquals(dataObject1, dataObject2);
// Test Background Set
BackgroundSet backgroundSet = new BackgroundSet();
backgroundSet.setBgColor(new BgColor("Black"));
dataObject2.setBackgroundSet(backgroundSet);
assertNotEquals(dataObject1, dataObject2);
// Reset
dataObject2.setBackgroundSet(new BackgroundSet());
assertEquals(dataObject1, dataObject2);
// Test Font Set
FontSet fontSet = new FontSet();
fontSet.setFontSize(new FontSize(11.0));
dataObject2.setFontSet(fontSet);
assertNotEquals(dataObject1, dataObject2);
// Reset
dataObject2.setFontSet(new FontSet());
assertEquals(dataObject1, dataObject2);
// Test Dimension Set
RectangleDimensionsSet rectangleDimensionsSet = new RectangleDimensionsSet(100.0, 100.0);
dataObject2.setDimensionsSet(rectangleDimensionsSet);
assertNotEquals(dataObject1, dataObject2);
// Reset
dataObject2.setDimensionsSet(new RectangleDimensionsSet());
assertEquals(dataObject1, dataObject2);
}
use of org.kie.workbench.common.stunner.bpmn.definition.property.artifacts.DataObjectType in project kie-wb-common by kiegroup.
the class ArtifactsConverter method toDataObject.
private BpmnNode toDataObject(org.eclipse.bpmn2.DataObjectReference element) {
DataObjectPropertyReader p = propertyReaderFactory.of(element);
Node<View<DataObject>, Edge> node = typedFactoryManager.newNode(element.getId(), DataObject.class);
DataObject definition = node.getContent().getDefinition();
definition.setName(new Name(revertIllegalCharsAttribute(p.getName())));
definition.setType(new DataObjectType(new DataObjectTypeValue(p.getType())));
node.getContent().setBounds(p.getBounds());
definition.setDimensionsSet(p.getRectangleDimensionsSet());
definition.setFontSet(p.getFontSet());
definition.setBackgroundSet(p.getBackgroundSet());
definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
return BpmnNode.of(node, p);
}
Aggregations