use of org.neo4j.kernel.api.index.PropertyAccessor in project neo4j by neo4j.
the class SimpleUniquenessVerifierTest method numericIndexVerificationNoDuplicates.
@Test
public void numericIndexVerificationNoDuplicates() throws Exception {
List<Object> data = asList(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1, Integer.MAX_VALUE);
PropertyAccessor propertyAccessor = newPropertyAccessor(data);
insert(data);
IndexSearcher indexSearcher = spy(searcherManager.acquire());
runUniquenessVerification(propertyAccessor, indexSearcher);
verify(indexSearcher, never()).search(any(Query.class), any(Collector.class));
}
use of org.neo4j.kernel.api.index.PropertyAccessor in project neo4j by neo4j.
the class ConstraintIndexCreatorTest method shouldReleaseSchemaLockWhileAwaitingIndexPopulation.
@Test
public void shouldReleaseSchemaLockWhileAwaitingIndexPopulation() throws Exception {
// given
StubKernel kernel = new StubKernel();
IndexingService indexingService = mock(IndexingService.class);
StatementOperationParts constraintCreationContext = mockedParts();
PropertyAccessor propertyAccessor = mock(PropertyAccessor.class);
KernelStatement state = mockedState();
when(constraintCreationContext.schemaReadOperations().indexGetCommittedId(state, index)).thenReturn(2468L);
IndexProxy indexProxy = mock(IndexProxy.class);
when(indexingService.getIndexProxy(anyLong())).thenReturn(indexProxy);
ConstraintIndexCreator creator = new ConstraintIndexCreator(() -> kernel, indexingService, propertyAccessor, true);
// when
creator.createUniquenessConstraintIndex(state, constraintCreationContext.schemaReadOperations(), index.schema());
// then
verify(state.locks().pessimistic()).releaseExclusive(ResourceTypes.SCHEMA, ResourceTypes.schemaResource());
verify(state.locks().pessimistic()).acquireExclusive(state.lockTracer(), ResourceTypes.SCHEMA, ResourceTypes.schemaResource());
}
Aggregations