use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class GraphDbStructureGuideTest method setUp.
@Before
public void setUp() throws InvalidTransactionTypeKernelException {
GraphDatabaseAPI api = dbRule.getGraphDatabaseAPI();
graph = api;
DependencyResolver dependencyResolver = api.getDependencyResolver();
this.bridge = dependencyResolver.resolveDependency(ThreadToStatementContextBridge.class);
this.tx = graph.beginTx();
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class Neo4jTransactionalContextFactory method create.
@Deprecated
public static TransactionalContextFactory create(GraphDatabaseQueryService queryService, PropertyContainerLocker locker) {
DependencyResolver resolver = queryService.getDependencyResolver();
ThreadToStatementContextBridge txBridge = resolver.resolveDependency(ThreadToStatementContextBridge.class);
Guard guard = resolver.resolveDependency(Guard.class);
Neo4jTransactionalContext.Creator contextCreator = (Supplier<Statement> statementSupplier, InternalTransaction tx, Statement initialStatement, ExecutingQuery executingQuery) -> new Neo4jTransactionalContext(queryService, statementSupplier, guard, txBridge, locker, tx, initialStatement, executingQuery);
return new Neo4jTransactionalContextFactory(txBridge, contextCreator);
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class BoltFactoryImpl method start.
@Override
public void start() throws Throwable {
DependencyResolver dependencyResolver = gds.getDependencyResolver();
queryExecutionEngine = dependencyResolver.resolveDependency(QueryExecutionEngine.class);
queryService = dependencyResolver.resolveDependency(GraphDatabaseQueryService.class);
transactionIdStore = dependencyResolver.resolveDependency(TransactionIdStore.class);
availabilityGuard = dependencyResolver.resolveDependency(AvailabilityGuard.class);
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class ShutdownOnIndexUpdateIT method shutdownWhileFinishingTransactionWithIndexUpdates.
@Test
public void shutdownWhileFinishingTransactionWithIndexUpdates() throws Exception {
GraphDatabaseService database = new TestGraphDatabaseFactory().newImpermanentDatabase();
createConstraint(database);
waitIndexesOnline(database);
try (Transaction transaction = database.beginTx()) {
Node node = database.createNode(constraintIndexLabel);
node.setProperty(UNIQUE_PROPERTY_NAME, indexProvider.getAndIncrement());
DependencyResolver dependencyResolver = ((GraphDatabaseAPI) database).getDependencyResolver();
NeoStoreDataSource dataSource = dependencyResolver.resolveDependency(NeoStoreDataSource.class);
LifeSupport dataSourceLife = dataSource.getLife();
TransactionCloseListener closeListener = new TransactionCloseListener(transaction);
dataSourceLife.addLifecycleListener(closeListener);
dataSource.stop();
assertTrue("Transaction should be closed and no exception should be thrown.", closeListener.isTransactionClosed());
}
}
use of org.neo4j.graphdb.DependencyResolver in project neo4j by neo4j.
the class FileWatchIT method doNotNotifyAboutLuceneIndexFilesDeletion.
@Test(timeout = TEST_TIMEOUT)
public void doNotNotifyAboutLuceneIndexFilesDeletion() throws InterruptedException, IOException {
DependencyResolver dependencyResolver = ((GraphDatabaseAPI) database).getDependencyResolver();
FileWatcher fileWatcher = getFileWatcher(database);
CheckPointer checkPointer = dependencyResolver.resolveDependency(CheckPointer.class);
String propertyStoreName = MetaDataStore.DEFAULT_NAME + StoreFactory.PROPERTY_STORE_NAME;
AccumulativeDeletionEventListener accumulativeListener = new AccumulativeDeletionEventListener();
ModificationEventListener modificationListener = new ModificationEventListener(propertyStoreName);
fileWatcher.addFileWatchEventListener(modificationListener);
fileWatcher.addFileWatchEventListener(accumulativeListener);
String labelName = "labelName";
String propertyName = "propertyName";
Label testLabel = Label.label(labelName);
createIndexes(database, propertyName, testLabel);
do {
createNode(database, propertyName, testLabel);
forceCheckpoint(checkPointer);
} while (!modificationListener.awaitModificationNotification());
fileWatcher.removeFileWatchEventListener(modificationListener);
ModificationEventListener afterRemovalListener = new ModificationEventListener(propertyStoreName);
fileWatcher.addFileWatchEventListener(afterRemovalListener);
dropAllIndexes(database);
do {
createNode(database, propertyName, testLabel);
forceCheckpoint(checkPointer);
} while (!afterRemovalListener.awaitModificationNotification());
accumulativeListener.assertDoesNotHaveAnyDeletions();
}
Aggregations