use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class KernelTransactionSecurityContextTest method shouldAllowReadsInFullMode.
@Test
public void shouldAllowReadsInFullMode() throws Throwable {
// Given
KernelTransactionImplementation tx = newTransaction(AUTH_DISABLED);
// When
ReadOperations reads = tx.acquireStatement().readOperations();
// Then
assertNotNull(reads);
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class RelationshipCountsTest method countsForRelationship.
/**
* @param start the label of the start node of relationships to get the number of, or {@code null} for "any".
* @param type the type of the relationships to get the number of, or {@code null} for "any".
* @param end the label of the end node of relationships to get the number of, or {@code null} for "any".
*/
private long countsForRelationship(Label start, RelationshipType type, Label end) {
ReadOperations read = statementSupplier.get().readOperations();
int startId, typeId, endId;
// start
if (start == null) {
startId = ReadOperations.ANY_LABEL;
} else {
if (ReadOperations.NO_SUCH_LABEL == (startId = read.labelGetForName(start.name()))) {
return 0;
}
}
// type
if (type == null) {
typeId = ReadOperations.ANY_RELATIONSHIP_TYPE;
} else {
if (ReadOperations.NO_SUCH_LABEL == (typeId = read.relationshipTypeGetForName(type.name()))) {
return 0;
}
}
// end
if (end == null) {
endId = ReadOperations.ANY_LABEL;
} else {
if (ReadOperations.NO_SUCH_LABEL == (endId = read.labelGetForName(end.name()))) {
return 0;
}
}
return read.countsForRelationship(startId, typeId, endId);
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class DataStatementArgumentVerificationTest method shouldReturnNoPropertyFromNodeGetPropertyWithoutDelegatingForNoSuchPropertyKeyIdConstant.
@Test
public void shouldReturnNoPropertyFromNodeGetPropertyWithoutDelegatingForNoSuchPropertyKeyIdConstant() throws Exception {
// given
ReadOperations statement = stubStatement();
// when
Object value = statement.nodeGetProperty(17, StatementConstants.NO_SUCH_PROPERTY_KEY);
// then
assertNull("should return NoProperty", value);
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class DataStatementArgumentVerificationTest method shouldReturnNoPropertyFromGraphGetPropertyWithoutDelegatingForNoSuchPropertyKeyIdConstant.
@Test
public void shouldReturnNoPropertyFromGraphGetPropertyWithoutDelegatingForNoSuchPropertyKeyIdConstant() throws Exception {
// given
ReadOperations statement = stubStatement();
// when
Object value = statement.graphGetProperty(StatementConstants.NO_SUCH_PROPERTY_KEY);
// then
assertNull("should return NoProperty", value);
}
use of org.neo4j.kernel.api.ReadOperations in project neo4j by neo4j.
the class MultiIndexPopulationConcurrentUpdatesIT method getLabelIdsByName.
private Map<String, Integer> getLabelIdsByName(String... names) {
ThreadToStatementContextBridge transactionStatementContextBridge = getTransactionStatementContextBridge();
ReadOperations readOperations = transactionStatementContextBridge.get().readOperations();
Map<String, Integer> labelNameIdMap = new HashMap<>();
for (String name : names) {
labelNameIdMap.put(name, readOperations.labelGetForName(name));
}
return labelNameIdMap;
}
Aggregations