Search in sources :

Example 6 with EdgeFactoryImpl

use of org.kie.workbench.common.stunner.core.factory.impl.EdgeFactoryImpl in project kie-wb-common by kiegroup.

the class TestingGraphMockHandler method init.

@SuppressWarnings("unchecked")
private TestingGraphMockHandler init() {
    MockitoAnnotations.initMocks(this);
    this.graphFactory = new GraphFactoryImpl(definitionManager);
    this.nodeFactory = new NodeFactoryImpl(definitionUtils);
    this.edgeFactory = new EdgeFactoryImpl(definitionManager);
    this.commandFactory = new GraphCommandFactory();
    this.graph = graphFactory.build(GRAPH_UUID, DEF_SET_ID);
    when(definitionUtils.getDefinitionManager()).thenReturn(definitionManager);
    when(definitionManager.definitionSets()).thenReturn(definitionSetRegistry);
    when(definitionManager.adapters()).thenReturn(adapterManager);
    when(adapterManager.registry()).thenReturn(adapterRegistry);
    when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
    when(adapterManager.forProperty()).thenReturn(propertyAdapter);
    when(adapterManager.forRules()).thenReturn(ruleAdapter);
    when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter);
    when(adapterRegistry.getPropertyAdapter(any(Class.class))).thenReturn(propertyAdapter);
    when(graphCommandExecutionContext.getDefinitionManager()).thenReturn(definitionManager);
    when(graphCommandExecutionContext.getFactoryManager()).thenReturn(factoryManager);
    when(graphCommandExecutionContext.getRuleManager()).thenReturn(ruleManager);
    when(graphCommandExecutionContext.getGraphIndex()).thenReturn(graphIndex);
    when(graphCommandExecutionContext.getRuleSet()).thenReturn(ruleSet);
    when(graphIndex.getGraph()).thenReturn(graph);
    when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(EMPTY_VIOLATIONS);
    return this;
}
Also used : GraphCommandFactory(org.kie.workbench.common.stunner.core.graph.command.impl.GraphCommandFactory) RuleSet(org.kie.workbench.common.stunner.core.rule.RuleSet) NodeFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.NodeFactoryImpl) EdgeFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.EdgeFactoryImpl) GraphFactoryImpl(org.kie.workbench.common.stunner.core.factory.impl.GraphFactoryImpl) RuleEvaluationContext(org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext)

Aggregations

EdgeFactoryImpl (org.kie.workbench.common.stunner.core.factory.impl.EdgeFactoryImpl)6 GraphFactoryImpl (org.kie.workbench.common.stunner.core.factory.impl.GraphFactoryImpl)6 NodeFactoryImpl (org.kie.workbench.common.stunner.core.factory.impl.NodeFactoryImpl)6 GraphCommandFactory (org.kie.workbench.common.stunner.core.graph.command.impl.GraphCommandFactory)6 BackendDefinitionAdapter (org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendDefinitionAdapter)5 BackendDefinitionSetAdapter (org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendDefinitionSetAdapter)5 RuleEvaluationContext (org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext)5 RuleSet (org.kie.workbench.common.stunner.core.rule.RuleSet)5 Before (org.junit.Before)4 TestScopeModelFactory (org.kie.workbench.common.stunner.backend.definition.factory.TestScopeModelFactory)4 BackendPropertyAdapter (org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendPropertyAdapter)4 BackendPropertySetAdapter (org.kie.workbench.common.stunner.core.backend.definition.adapter.reflect.BackendPropertySetAdapter)4 GraphCommandManagerImpl (org.kie.workbench.common.stunner.core.graph.command.GraphCommandManagerImpl)4 DefinitionUtils (org.kie.workbench.common.stunner.core.util.DefinitionUtils)4 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)3 BPMNDefinitionSet (org.kie.workbench.common.stunner.bpmn.BPMNDefinitionSet)3 BPMNDiagramMarshaller (org.kie.workbench.common.stunner.bpmn.backend.BPMNDiagramMarshaller)3 BPMNDirectDiagramMarshaller (org.kie.workbench.common.stunner.bpmn.backend.BPMNDirectDiagramMarshaller)3 BPMNGraphObjectBuilderFactory (org.kie.workbench.common.stunner.bpmn.backend.marshall.json.builder.BPMNGraphObjectBuilderFactory)3