use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class GraphDbStructureGuide method showStructure.
private void showStructure(Statement statement, DbStructureVisitor visitor) {
ReadOperations read = statement.readOperations();
try {
showTokens(visitor, read);
showSchema(visitor, read);
showStatistics(visitor, read);
} catch (KernelException e) {
throw new IllegalStateException("Kernel exception when traversing database schema structure and statistics. This is not expected to happen.", e);
}
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class CompiledExpandUtilsTest method shouldUseGivenOrderIfItHasLowerDegreeWithTypes.
@Test
public void shouldUseGivenOrderIfItHasLowerDegreeWithTypes() throws EntityNotFoundException {
// GIVEN
ReadOperations readOperations = mock(ReadOperations.class);
when(readOperations.nodeGetDegree(1L, Direction.OUTGOING, 1)).thenReturn(1);
when(readOperations.nodeGetDegree(2L, Direction.INCOMING, 1)).thenReturn(3);
// WHEN
connectingRelationships(readOperations, 1L, Direction.OUTGOING, 2L, new int[] { 1 });
// THEN
verify(readOperations, times(1)).nodeGetRelationships(1L, Direction.OUTGOING, new int[] { 1 });
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class CompiledExpandUtilsTest method shouldSwitchOrderIfItHasLowerDegree.
@Test
public void shouldSwitchOrderIfItHasLowerDegree() throws EntityNotFoundException {
// GIVEN
ReadOperations readOperations = mock(ReadOperations.class);
when(readOperations.nodeGetDegree(1L, Direction.OUTGOING)).thenReturn(3);
when(readOperations.nodeGetDegree(2L, Direction.INCOMING)).thenReturn(1);
// WHEN
connectingRelationships(readOperations, 1L, Direction.OUTGOING, 2L);
// THEN
verify(readOperations, times(1)).nodeGetRelationships(2L, Direction.INCOMING);
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class CompiledExpandUtilsTest method shouldUseGivenOrderIfItHasLowerDegree.
@Test
public void shouldUseGivenOrderIfItHasLowerDegree() throws EntityNotFoundException {
// GIVEN
ReadOperations readOperations = mock(ReadOperations.class);
when(readOperations.nodeGetDegree(1L, Direction.OUTGOING)).thenReturn(1);
when(readOperations.nodeGetDegree(2L, Direction.INCOMING)).thenReturn(3);
// WHEN
connectingRelationships(readOperations, 1L, Direction.OUTGOING, 2L);
// THEN
verify(readOperations, times(1)).nodeGetRelationships(1L, Direction.OUTGOING);
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class CompiledExpandUtilsTest method shouldSwitchOrderIfItHasLowerDegreeWithTypes.
@Test
public void shouldSwitchOrderIfItHasLowerDegreeWithTypes() throws EntityNotFoundException {
// GIVEN
ReadOperations readOperations = mock(ReadOperations.class);
when(readOperations.nodeGetDegree(1L, Direction.OUTGOING, 1)).thenReturn(3);
when(readOperations.nodeGetDegree(2L, Direction.INCOMING, 1)).thenReturn(1);
// WHEN
connectingRelationships(readOperations, 1L, Direction.OUTGOING, 2L, new int[] { 1 });
// THEN
verify(readOperations, times(1)).nodeGetRelationships(2L, Direction.INCOMING, new int[] { 1 });
}
Aggregations