use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class StorageLayerRelTypesAndDegreeTest method relTypeForId.
private TestRelType relTypeForId(int id) {
DependencyResolver resolver = db.getDependencyResolver();
RelationshipTypeTokenHolder relTypeHolder = resolver.resolveDependency(RelationshipTypeTokenHolder.class);
try {
String typeName = relTypeHolder.getTokenById(id).name();
return TestRelType.valueOf(typeName);
} catch (TokenNotFoundException e) {
throw new RuntimeException(e);
}
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class GraphDatabaseFacadeTest method setUp.
@Before
public void setUp() {
queryService = mock(GraphDatabaseQueryService.class);
DependencyResolver resolver = mock(DependencyResolver.class);
Statement statement = mock(Statement.class, RETURNS_DEEP_STUBS);
ThreadToStatementContextBridge contextBridge = mock(ThreadToStatementContextBridge.class);
when(spi.queryService()).thenReturn(queryService);
when(spi.resolver()).thenReturn(resolver);
when(resolver.resolveDependency(ThreadToStatementContextBridge.class)).thenReturn(contextBridge);
when(resolver.resolveDependency(Guard.class)).thenReturn(mock(Guard.class));
when(contextBridge.get()).thenReturn(statement);
when(resolver.resolveDependency(Config.class)).thenReturn(Config.embeddedDefaults());
graphDatabaseFacade.init(spi);
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class Neo4jTransactionalContextTest method setUpMocks.
private void setUpMocks() {
queryService = mock(GraphDatabaseQueryService.class);
DependencyResolver resolver = mock(DependencyResolver.class);
ThreadToStatementContextBridge txBridge = mock(ThreadToStatementContextBridge.class);
guard = mock(Guard.class);
initialStatement = mock(KernelStatement.class);
QueryRegistryOperations queryRegistryOperations = mock(QueryRegistryOperations.class);
when(initialStatement.queryRegistration()).thenReturn(queryRegistryOperations);
when(queryService.getDependencyResolver()).thenReturn(resolver);
when(resolver.resolveDependency(ThreadToStatementContextBridge.class)).thenReturn(txBridge);
when(resolver.resolveDependency(Guard.class)).thenReturn(guard);
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class SchemaStorageTest method readOps.
private ReadOperations readOps() {
DependencyResolver dependencyResolver = dependencyResolver();
Statement statement = dependencyResolver.resolveDependency(ThreadToStatementContextBridge.class).get();
return statement.readOperations();
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class NonIndexedConflictResolverTest method setUp.
@Before
public void setUp() {
api = dbRule.getGraphDatabaseAPI();
String propKeyA = "keyA";
String propKeyB = "keyB";
String propKeyC = "keyC";
String propKeyD = "keyD";
String propKeyE = "keyE";
try (Transaction transaction = api.beginTx()) {
Node nodeA = api.createNode();
nodeA.setProperty(propKeyA, "value");
nodeA.setProperty(propKeyB, "value");
nodeIdA = nodeA.getId();
Node nodeB = api.createNode();
nodeB.setProperty(propKeyA, "value");
nodeB.setProperty(propKeyB, "value");
nodeIdB = nodeB.getId();
Node nodeC = api.createNode();
nodeC.setProperty(propKeyA, "longer val");
nodeC.setProperty(propKeyB, "longer val");
nodeC.setProperty(propKeyC, "longer val");
nodeC.setProperty(propKeyD, "longer val");
nodeC.setProperty(propKeyE, "longer val");
nodeIdC = nodeC.getId();
transaction.success();
}
DependencyResolver resolver = api.getDependencyResolver();
NeoStores neoStores = resolver.resolveDependency(RecordStorageEngine.class).testAccessNeoStores();
nodeStore = neoStores.getNodeStore();
propertyStore = neoStores.getPropertyStore();
propertyKeyTokenStore = neoStores.getPropertyKeyTokenStore();
tokenA = findTokenFor(propertyKeyTokenStore, propKeyA);
Token tokenB = findTokenFor(propertyKeyTokenStore, propKeyB);
Token tokenC = findTokenFor(propertyKeyTokenStore, propKeyC);
Token tokenD = findTokenFor(propertyKeyTokenStore, propKeyD);
Token tokenE = findTokenFor(propertyKeyTokenStore, propKeyE);
replacePropertyKey(propertyStore, nodeStore.getRecord(nodeIdA, nodeStore.newRecord(), FORCE), tokenB, tokenA);
replacePropertyKey(propertyStore, nodeStore.getRecord(nodeIdB, nodeStore.newRecord(), FORCE), tokenB, tokenA);
NodeRecord nodeRecordC = nodeStore.getRecord(nodeIdC, nodeStore.newRecord(), FORCE);
replacePropertyKey(propertyStore, nodeRecordC, tokenB, tokenA);
replacePropertyKey(propertyStore, nodeRecordC, tokenC, tokenA);
replacePropertyKey(propertyStore, nodeRecordC, tokenD, tokenA);
replacePropertyKey(propertyStore, nodeRecordC, tokenE, tokenA);
}
Aggregations