@Test @SuppressWarnings("unchecked") public void testBuild() { final Node diagramNode = mock(Node.class); final Node startEventNode = mock(Node.class); when(factoryManager.newElement(anyString(), eq(getDefinitionId(BPMNDiagramImpl.class)))).thenReturn(diagramNode); when(factoryManager.newElement(anyString(), eq(getDefinitionId(StartNoneEvent.class)))).thenReturn(startEventNode); final Graph<DefinitionSet, Node> graph = tested.build("uuid1", "defSetId"); assertNotNull(graph); assertEquals("uuid1", graph.getUUID()); assertEquals(1, graph.getLabels().size()); assertTrue(graph.getLabels().contains("defSetId")); final ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class); verify(graphCommandFactory, times(1)).addNode(eq(diagramNode)); verify(graphCommandManager, times(1)).execute(any(GraphCommandExecutionContext.class), commandCaptor.capture()); final Command command = commandCaptor.getValue(); assertTrue(command instanceof CompositeCommand); final CompositeCommand compositeCommand = (CompositeCommand) command; assertEquals(1, compositeCommand.size()); }
@Override @SuppressWarnings("unchecked") public Graph<DefinitionSet, Node> build(final String uuid, final String definitionSetId) { final Graph<DefinitionSet, Node> graph = super.build(uuid, definitionSetId); final List<Command> commands = buildInitialisationCommands(); final CompositeCommand.Builder commandBuilder = new CompositeCommand.Builder(); commands.forEach(commandBuilder::addCommand); graphCommandManager.execute(createGraphContext(graph), commandBuilder.build()); return graph; }
BPMNGraphFactoryImpl extends AbstractGraphFactory implements BPMNGraphFactory { @Override @SuppressWarnings("unchecked") public Graph<DefinitionSet, Node> build(final String uuid, final String definitionSetId) { final Graph<DefinitionSet, Node> graph = super.build(uuid, definitionSetId); final List<Command> commands = buildInitialisationCommands(); final CompositeCommand.Builder commandBuilder = new CompositeCommand.Builder(); commands.forEach(commandBuilder::addCommand); graphCommandManager.execute(createGraphContext(graph), commandBuilder.build()); return graph; } }
BPMNGraphFactoryImpl extends AbstractGraphFactory implements BPMNGraphFactory { @Override @SuppressWarnings("unchecked") public Graph<DefinitionSet, Node> build(final String uuid, final String definitionSetId) { final Graph<DefinitionSet, Node> graph = super.build(uuid, definitionSetId); final List<Command> commands = buildInitialisationCommands(); final CompositeCommand.Builder commandBuilder = new CompositeCommand.Builder(); commands.forEach(commandBuilder::addCommand); graphCommandManager.execute(createGraphContext(graph), commandBuilder.build()); return graph; } protected  BPMNGraphFactoryImpl(); @Inject  BPMNGraphFactoryImpl(final DefinitionManager definitionManager,
                                final FactoryManager factoryManager,
                                final RuleManager ruleManager,
                                final GraphCommandManager graphCommandManager,
                                final GraphCommandFactory graphCommandFactory,
                                final GraphIndexBuilder<?> indexBuilder); }
BPMNGraphFactoryImpl extends AbstractGraphFactory implements BPMNGraphFactory { @Override @SuppressWarnings("unchecked") public Graph<DefinitionSet, Node> build(final String uuid, final String definitionSetId) { final Graph<DefinitionSet, Node> graph = super.build(uuid, definitionSetId); final List<Command> commands = buildInitialisationCommands(); final CompositeCommand.Builder commandBuilder = new CompositeCommand.Builder(); commands.forEach(commandBuilder::addCommand); graphCommandManager.execute(createGraphContext(graph), commandBuilder.build()); return graph; } protected  BPMNGraphFactoryImpl(); @Inject  BPMNGraphFactoryImpl(final DefinitionManager definitionManager,
                                final FactoryManager factoryManager,
                                final RuleManager ruleManager,
                                final GraphCommandManager graphCommandManager,
                                final GraphCommandFactory graphCommandFactory,
                                final GraphIndexBuilder<?> indexBuilder); void setDiagramType(final Class<? extends BPMNDiagram> diagramType); Class<? extends BPMNDiagram> getDiagramType(); @Override Class<? extends ElementFactory> getFactoryType(); @Override @SuppressWarnings("unchecked") Graph<DefinitionSet, Node> build(final String uuid,
                                            final String definitionSetId); @Override boolean accepts(final String source); }
BPMNGraphFactoryImpl extends AbstractGraphFactory implements BPMNGraphFactory { @Override @SuppressWarnings("unchecked") public Graph<DefinitionSet, Node> build(final String uuid, final String definitionSetId) { final Graph<DefinitionSet, Node> graph = super.build(uuid, definitionSetId); final List<Command> commands = buildInitialisationCommands(); final CompositeCommand.Builder commandBuilder = new CompositeCommand.Builder(); commands.forEach(commandBuilder::addCommand); graphCommandManager.execute(createGraphContext(graph), commandBuilder.build()); return graph; } protected  BPMNGraphFactoryImpl(); @Inject  BPMNGraphFactoryImpl(final DefinitionManager definitionManager,
                                final FactoryManager factoryManager,
                                final RuleManager ruleManager,
                                final GraphCommandManager graphCommandManager,
                                final GraphCommandFactory graphCommandFactory,
                                final GraphIndexBuilder<?> indexBuilder); void setDiagramType(final Class<? extends BPMNDiagram> diagramType); Class<? extends BPMNDiagram> getDiagramType(); @Override Class<? extends ElementFactory> getFactoryType(); @Override @SuppressWarnings("unchecked") Graph<DefinitionSet, Node> build(final String uuid,
                                            final String definitionSetId); @Override boolean accepts(final String source); static final String START_EVENT_ID; }