use of org.neo4j.kernel.impl.api.store.StoreStatement in project neo4j by neo4j.
the class LabelTransactionStateTest method before.
@Before
public void before() throws Exception {
store = mock(StoreReadLayer.class);
when(store.indexesGetForLabel(anyInt())).then(answerAsIteratorFrom(Collections.emptyList()));
when(store.indexesGetAll()).then(answerAsIteratorFrom(Collections.emptyList()));
txState = new TxState();
state = StatementOperationsTestHelper.mockedState(txState);
txContext = new StateHandlingStatementOperations(store, mock(InternalAutoIndexing.class), mock(ConstraintIndexCreator.class), mock(LegacyIndexStore.class));
storeStatement = mock(StoreStatement.class);
when(state.getStoreStatement()).thenReturn(storeStatement);
}
use of org.neo4j.kernel.impl.api.store.StoreStatement in project neo4j by neo4j.
the class RecordStorageEngine method storeStatementSupplier.
private Supplier<StorageStatement> storeStatementSupplier(NeoStores neoStores) {
Supplier<IndexReaderFactory> indexReaderFactory = () -> new IndexReaderFactory.Caching(indexingService);
LockService lockService = takePropertyReadLocks ? this.lockService : NO_LOCK_SERVICE;
return () -> new StoreStatement(neoStores, indexReaderFactory, labelScanStore::newReader, lockService);
}
use of org.neo4j.kernel.impl.api.store.StoreStatement in project neo4j by neo4j.
the class SchemaTransactionStateTest method before.
@Before
public void before() throws Exception {
txState = new TxState();
state = StatementOperationsTestHelper.mockedState(txState);
store = mock(StoreReadLayer.class);
when(store.indexesGetForLabel(labelId1)).then(asAnswer(Collections.<NewIndexDescriptor>emptyList()));
when(store.indexesGetForLabel(labelId2)).then(asAnswer(Collections.<NewIndexDescriptor>emptyList()));
when(store.indexesGetAll()).then(asAnswer(Collections.<NewIndexDescriptor>emptyList()));
txContext = new StateHandlingStatementOperations(store, mock(InternalAutoIndexing.class), mock(ConstraintIndexCreator.class), mock(LegacyIndexStore.class));
storeStatement = mock(StoreStatement.class);
when(state.getStoreStatement()).thenReturn(storeStatement);
}
use of org.neo4j.kernel.impl.api.store.StoreStatement in project neo4j by neo4j.
the class StateHandlingStatementOperationsTest method shouldNeverDelegateWrites.
@Test
public void shouldNeverDelegateWrites() throws Exception {
KernelStatement state = mockedState();
when(state.txState()).thenReturn(new TxState());
StoreStatement storeStatement = mock(StoreStatement.class);
when(state.getStoreStatement()).thenReturn(storeStatement);
when(inner.indexesGetForLabel(0)).thenReturn(iterator(NewIndexDescriptorFactory.forLabel(0, 0)));
when(storeStatement.acquireSingleNodeCursor(anyLong())).thenReturn(asNodeCursor(0));
when(inner.nodeGetProperties(eq(storeStatement), any(NodeItem.class))).thenReturn(asPropertyCursor());
StateHandlingStatementOperations ctx = newTxStateOps(inner);
// When
LabelSchemaDescriptor descriptor = SchemaDescriptorFactory.forLabel(0, 0);
ctx.indexCreate(state, descriptor);
ctx.nodeAddLabel(state, 0, 0);
ctx.indexDrop(state, NewIndexDescriptorFactory.forSchema(descriptor));
ctx.nodeRemoveLabel(state, 0, 0);
// one for add and one for remove
verify(storeStatement, times(2)).acquireSingleNodeCursor(0);
verifyNoMoreInteractions(storeStatement);
}
use of org.neo4j.kernel.impl.api.store.StoreStatement in project neo4j by neo4j.
the class StateHandlingStatementOperationsTest method indexQueryClosesIndexReader.
@Test
public void indexQueryClosesIndexReader() throws Exception {
KernelStatement kernelStatement = mock(KernelStatement.class);
StoreStatement storeStatement = mock(StoreStatement.class);
IndexReader indexReader = mock(IndexReader.class);
when(indexReader.query(any())).thenReturn(PrimitiveLongCollections.emptyIterator());
when(storeStatement.getFreshIndexReader(any())).thenReturn(indexReader);
when(kernelStatement.getStoreStatement()).thenReturn(storeStatement);
StateHandlingStatementOperations operations = newTxStateOps(mock(StoreReadLayer.class));
operations.nodeGetFromUniqueIndexSeek(kernelStatement, NewIndexDescriptorFactory.uniqueForLabel(1, 1), IndexQuery.exact(1, "foo"));
verify(indexReader).close();
}
Aggregations