use of org.kie.workbench.common.stunner.core.rule.context.impl.StatefulGraphEvaluationState in project kie-wb-common by kiegroup.
the class ConnectorParentsMatchContainmentHandlerTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
super.setup();
candidates = Collections.singletonList(nodeA);
when(graphHandler.getDefinitionAdapter().getId(eq(connectorDef))).thenReturn(DefinitionId.build(DEF_EDGE_ID));
this.connector = graphHandler.newEdge(EDGE_UUID, Optional.of(connectorDef));
GraphEvaluationState state = new StatefulGraphEvaluationState(graphHandler.graph);
when(containmentContext.getState()).thenReturn(state);
when(ruleExtension.getId()).thenReturn(DEF_EDGE_ID);
when(ruleExtension.getArguments()).thenReturn(new String[] { "violation1" });
tested = new ConnectorParentsMatchContainmentHandler(graphHandler.getDefinitionManager(), new TreeWalkTraverseProcessorImpl());
}
use of org.kie.workbench.common.stunner.core.rule.context.impl.StatefulGraphEvaluationState in project kie-wb-common by kiegroup.
the class ConnectorParentsMatchConnectionHandlerTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
super.setup();
this.graph = graphHandler.graph;
when(graphHandler.getDefinitionAdapter().getId(eq(connectorDef))).thenReturn(DefinitionId.build(DEF_EDGE_ID));
this.connector = graphHandler.newEdge(EDGE_UUID, Optional.of(connectorDef));
GraphEvaluationState state = new StatefulGraphEvaluationState(graph);
when(connectionContext.getState()).thenReturn(state);
when(connectionContext.getConnector()).thenReturn(connector);
when(ruleExtension.getId()).thenReturn(DEF_EDGE_ID);
when(ruleExtension.getArguments()).thenReturn(new String[] { "violation1" });
tested = new ConnectorParentsMatchConnectionHandler(graphHandler.getDefinitionManager());
}
use of org.kie.workbench.common.stunner.core.rule.context.impl.StatefulGraphEvaluationState in project kie-wb-common by kiegroup.
the class GraphConnectionEvaluationHandlerTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
super.setup();
final Set<String> edgeLabels = Collections.singleton(EDGE_ID);
when(edge.getContent()).thenReturn(edgeContent);
when(edge.getLabels()).thenReturn(edgeLabels);
when(edgeContent.getDefinition()).thenReturn(edgeDefinition);
when(definitionAdapter.getId(eq(edgeDefinition))).thenReturn(DefinitionId.build(EDGE_ID));
when(context.getConnector()).thenReturn(edge);
when(context.getSource()).thenReturn(Optional.of(parent));
when(context.getTarget()).thenReturn(Optional.of(candidate));
StatefulGraphEvaluationState state = new StatefulGraphEvaluationState(GraphImpl.build("graphUUID"));
when(context.getState()).thenReturn(state);
tested = new GraphConnectionEvaluationHandler(definitionManager, HANDLER);
}
use of org.kie.workbench.common.stunner.core.rule.context.impl.StatefulGraphEvaluationState in project kie-wb-common by kiegroup.
the class ConnectorCardinalityEvaluationHandlerTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
super.setup();
final Set<String> edgeLabels = Collections.singleton(EDGE_ID);
evalUtils = spy(new GraphEvaluationHandlerUtils(definitionManager));
StatefulGraphEvaluationState graphEvaluationState = new StatefulGraphEvaluationState(mock(Graph.class));
when(context.getState()).thenReturn(graphEvaluationState);
when(context.getCandidate()).thenReturn(candidate);
when(context.getEdge()).thenReturn(edge);
when(edge.getContent()).thenReturn(edgeContent);
when(edge.getLabels()).thenReturn(edgeLabels);
when(edgeContent.getDefinition()).thenReturn(edgeDefinition);
when(definitionAdapter.getId(eq(edgeDefinition))).thenReturn(DefinitionId.build(EDGE_ID));
tested = new ConnectorCardinalityEvaluationHandler(evalUtils, new EdgeCardinalityEvaluationHandler());
}
Aggregations