use of org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory in project kie-wb-common by kiegroup.
the class GraphBuilderTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
when(diagram.getPlane()).thenReturn(plane);
List<RootElement> rootElements = Collections.singletonList(process);
List<BPMNDiagram> diagrams = Collections.singletonList(diagram);
when(definitions.getId()).thenReturn(DIAGRAM_UUID);
when(definitions.getRootElements()).thenReturn(rootElements);
when(definitions.getDiagrams()).thenReturn(diagrams);
when(definitions.getRelationships()).thenReturn(Collections.emptyList());
definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
StunnerTestingGraphBackendAPI api = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory());
TypedFactoryManager typedFactoryManager = new TypedFactoryManager(api.getFactoryManager());
Metadata metadata = new MetadataImpl.MetadataImplBuilder(BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class)).build();
Diagram<Graph<DefinitionSet, Node>, Metadata> diagram = api.getFactoryManager().newDiagram(definitionResolver.getDefinitions().getId(), BPMN_ID, metadata);
graph = diagram.getGraph();
graphBuilder = new GraphBuilder(graph, api.getDefinitionManager(), typedFactoryManager, api.getRuleManager(), api.commandFactory, api.commandManager);
}
use of org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory in project kie-wb-common by kiegroup.
the class ProcessConverterDelegateTest method setUp.
@Before
public void setUp() throws Exception {
parentNode = new BpmnNode.Simple(new NodeImpl<>("ParentNode"), basePropertyReader);
when(diagram.getPlane()).thenReturn(plane);
List<RootElement> rootElements = Collections.singletonList(process);
List<BPMNDiagram> diagrams = Collections.singletonList(diagram);
when(definitions.getRootElements()).thenReturn(rootElements);
when(definitions.getDiagrams()).thenReturn(diagrams);
when(definitions.getRelationships()).thenReturn(Collections.emptyList());
when(plane.getPlaneElement()).thenReturn(new ArrayList<>());
definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
StunnerTestingGraphBackendAPI api = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory());
TypedFactoryManager typedFactoryManager = new TypedFactoryManager(api.getFactoryManager());
factory = new ConverterFactory(definitionResolver, typedFactoryManager);
converterDelegate = new ProcessConverterDelegate(typedFactoryManager, propertyReaderFactory, definitionResolver, factory);
}
use of org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerBaseTest method init.
@SuppressWarnings("unchecked")
protected void init() {
initMocks(this);
cloneManager = mock(CloneManager.class);
try {
api = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory());
} catch (Exception e) {
fail("Cannot instantiate DefinitionSet [message=" + e.getMessage() + "]");
}
BackendBindableMorphAdapter<Object> morphAdapter = new BackendBindableMorphAdapter(api.getDefinitionUtils(), api.getFactoryManager(), cloneManager, singletonList(new BaseTaskMorphPropertyDefinition()));
doReturn(morphAdapter).when(api.getAdapterRegistry()).getMorphAdapter(eq(UserTask.class));
doReturn(morphAdapter).when(api.getAdapterRegistry()).getMorphAdapter(eq(NoneTask.class));
doReturn(morphAdapter).when(api.getAdapterRegistry()).getMorphAdapter(eq(ScriptTask.class));
doReturn(morphAdapter).when(api.getAdapterRegistry()).getMorphAdapter(eq(BusinessRuleTask.class));
workItemDefinitionMockRegistry = new WorkItemDefinitionMockRegistry();
WorkItemDefinitionLookupService widService = mock(WorkItemDefinitionLookupService.class);
when(widService.execute(any(Metadata.class))).thenReturn(workItemDefinitionMockRegistry.items());
marshaller = new BPMNDirectDiagramMarshaller(new XMLEncoderDiagramMetadataMarshaller(), api.getDefinitionManager(), api.getRuleManager(), widService, api.getFactoryManager(), api.commandFactory, api.commandManager, dataTypeCacheServer);
}
use of org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
// Setup context.
widRegistry = new WorkItemDefinitionMockRegistry();
widService = mock(WorkItemDefinitionLookupService.class);
when(widService.execute(any(Metadata.class))).thenReturn(widRegistry.items());
stunnerAPI = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory(widRegistry));
xmlEncoder = new XMLEncoderDiagramMetadataMarshaller();
// Setup tested instance.
tested = new BPMNDirectDiagramMarshaller(xmlEncoder, stunnerAPI.getDefinitionManager(), stunnerAPI.getRuleManager(), widService, stunnerAPI.getFactoryManager(), stunnerAPI.commandFactory, stunnerAPI.commandManager, dataTypeCacheServer);
}
use of org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory in project kie-wb-common by kiegroup.
the class NoWIDCustomTaskResolutionTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
// Setup context.
widRegistry = new WorkItemDefinitionRegistry() {
@Override
public Collection<WorkItemDefinition> items() {
return Collections.EMPTY_LIST;
}
@Override
public WorkItemDefinition get(String name) {
return null;
}
};
widService = mock(WorkItemDefinitionLookupService.class);
when(widService.execute(any(Metadata.class))).thenReturn(widRegistry.items());
stunnerAPI = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory(widRegistry));
xmlEncoder = new XMLEncoderDiagramMetadataMarshaller();
// Setup tested instance.
tested = new BPMNDirectDiagramMarshaller(xmlEncoder, stunnerAPI.getDefinitionManager(), stunnerAPI.getRuleManager(), widService, stunnerAPI.getFactoryManager(), stunnerAPI.commandFactory, stunnerAPI.commandManager, dataTypeCacheServer);
diagram = Unmarshalling.unmarshall(tested, BPMN_CUSTOM_TASK);
}
Aggregations