use of org.kie.dmn.model.v1_1.Definitions in project kie-wb-common by kiegroup.
the class JBPMBpmn2ResourceFactory method createAndInitResource.
/*
*
* Creates a new BpmnResourceImpl and initializes it.
*
* The method creates a DocumentRoot and a Definitions element, as both are
* mandatory.
*/
public Definitions createAndInitResource(URI uri) {
DroolsFactoryImpl.init();
BpsimFactoryImpl.init();
Resource resource = createResource(uri);
Bpmn2Factory factory = Bpmn2Factory.eINSTANCE;
Definitions definitions = factory.createDefinitions();
DocumentRoot docummentRoot = factory.createDocumentRoot();
docummentRoot.setDefinitions(definitions);
resource.getContents().add(docummentRoot);
return definitions;
}
use of org.kie.dmn.model.v1_1.Definitions in project kie-wb-common by kiegroup.
the class AssociationsTest method marshallAssociations.
@Test
public void marshallAssociations() throws Exception {
Diagram<Graph, Metadata> d = unmarshall(marshaller, BPMN_FILE_PATH);
DefinitionsConverter definitionsConverter = new DefinitionsConverter(d.getGraph());
Definitions definitions = definitionsConverter.toDefinitions();
Process p = (Process) definitions.getRootElements().get(0);
org.eclipse.bpmn2.UserTask flowElement = (org.eclipse.bpmn2.UserTask) p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get();
List<DataInputAssociation> associations = flowElement.getDataInputAssociations();
assertEquals("myprocvar", findVar(associations, "From"));
assertEquals("<![CDATA[HELLO]]>", findAssignment(associations, "Body"));
}
use of org.kie.dmn.model.v1_1.Definitions in project kie-wb-common by kiegroup.
the class SubProcessConverterTest method setUp.
@Before
public void setUp() {
Definitions definitions = bpmn2.createDefinitions();
definitions.getRootElements().add(bpmn2.createProcess());
BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
bpmnDiagram.setPlane(di.createBPMNPlane());
definitions.getDiagrams().add(bpmnDiagram);
definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
Node adHocNode = new NodeImpl("");
View<AdHocSubprocess> adHocContent = new ViewImpl<>(new AdHocSubprocess(), Bounds.create());
adHocNode.setContent(adHocContent);
Node multipleInstanceNode = new NodeImpl("");
View<MultipleInstanceSubprocess> miContent = new ViewImpl<>(new MultipleInstanceSubprocess(), Bounds.create());
multipleInstanceNode.setContent(miContent);
Node embeddedNode = new NodeImpl("");
View<EmbeddedSubprocess> embeddedContent = new ViewImpl<>(new EmbeddedSubprocess(), Bounds.create());
embeddedNode.setContent(embeddedContent);
Node eventNode = new NodeImpl("");
View<EventSubprocess> eventSubprocess = new ViewImpl<>(new EventSubprocess(), Bounds.create());
eventNode.setContent(eventSubprocess);
FactoryManager factoryManager = mock(FactoryManager.class);
when(factoryManager.newElement(any(), eq(getDefinitionId(AdHocSubprocess.class)))).thenReturn(adHocNode);
when(factoryManager.newElement(any(), eq(getDefinitionId(MultipleInstanceSubprocess.class)))).thenReturn(multipleInstanceNode);
when(factoryManager.newElement(any(), eq(getDefinitionId(EmbeddedSubprocess.class)))).thenReturn(embeddedNode);
when(factoryManager.newElement(any(), eq(getDefinitionId(EventSubprocess.class)))).thenReturn(eventNode);
TypedFactoryManager typedFactoryManager = new TypedFactoryManager(factoryManager);
tested = new SubProcessConverter(typedFactoryManager, new PropertyReaderFactory(definitionResolver), definitionResolver, new ConverterFactory(definitionResolver, typedFactoryManager));
}
use of org.kie.dmn.model.v1_1.Definitions in project kie-wb-common by kiegroup.
the class AdHocSubProcessPropertyReaderTest method setUp.
@Before
public void setUp() {
Definitions definitions = bpmn2.createDefinitions();
definitions.getRootElements().add(bpmn2.createProcess());
BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
bpmnDiagram.setPlane(di.createBPMNPlane());
definitions.getDiagrams().add(bpmnDiagram);
definitionResolverReal = new DefinitionResolver(definitions, Collections.emptyList());
propertyReader = new AdHocSubProcessPropertyReader(process, diagram, definitionResolver);
}
use of org.kie.dmn.model.v1_1.Definitions in project kie-wb-common by kiegroup.
the class RootProcessConverterTest method setUp.
@Before
@SuppressWarnings("all")
public void setUp() {
Definitions definitions = bpmn2.createDefinitions();
process = bpmn2.createProcess();
definitions.getRootElements().add(process);
BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
bpmnDiagram.setPlane(di.createBPMNPlane());
definitions.getDiagrams().add(bpmnDiagram);
ElementDefinition.getExtensionElements(process).add(DefaultImportsElement.extensionOf(new DefaultImport(getClass().getName())));
definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
Node node = new NodeImpl("");
View<BPMNDiagramImpl> content = new ViewImpl<>(new BPMNDiagramImpl(), Bounds.create());
node.setContent(content);
FactoryManager factoryManager = mock(FactoryManager.class);
when(factoryManager.newElement(any(), eq(getDefinitionId(BPMNDiagramImpl.class)))).thenReturn(node);
TypedFactoryManager typedFactoryManager = new TypedFactoryManager(factoryManager);
tested = new RootProcessConverter(typedFactoryManager, new PropertyReaderFactory(definitionResolver), definitionResolver, new ConverterFactory(definitionResolver, typedFactoryManager));
}
Aggregations