Search in sources :

Example 1 with SimpleUniquenessVerifier

use of org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier in project neo4j by neo4j.

the class LuceneSchemaIndex method createSimpleUniquenessVerifier.

private UniquenessVerifier createSimpleUniquenessVerifier(List<AbstractIndexPartition> partitions) throws IOException {
    AbstractIndexPartition singlePartition = getFirstPartition(partitions);
    PartitionSearcher partitionSearcher = singlePartition.acquireSearcher();
    return new SimpleUniquenessVerifier(partitionSearcher);
}
Also used : SimpleUniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier) PartitionSearcher(org.neo4j.kernel.api.impl.index.partition.PartitionSearcher) AbstractIndexPartition(org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition)

Example 2 with SimpleUniquenessVerifier

use of org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier in project neo4j by neo4j.

the class SimpleUniquenessVerifierTest method partitionSearcherIsClosed.

@Test
public void partitionSearcherIsClosed() throws IOException {
    PartitionSearcher partitionSearcher = mock(PartitionSearcher.class);
    SimpleUniquenessVerifier verifier = new SimpleUniquenessVerifier(partitionSearcher);
    verifier.close();
    verify(partitionSearcher).close();
}
Also used : SimpleUniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier) PartitionSearcher(org.neo4j.kernel.api.impl.index.partition.PartitionSearcher) Test(org.junit.Test)

Example 3 with SimpleUniquenessVerifier

use of org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier in project neo4j by neo4j.

the class SimpleUniquenessVerifierTest method runUniquenessVerification.

private void runUniquenessVerification(PropertyAccessor propertyAccessor, IndexSearcher indexSearcher) throws IOException, IndexEntryConflictException {
    try {
        PartitionSearcher partitionSearcher = mock(PartitionSearcher.class);
        when(partitionSearcher.getIndexSearcher()).thenReturn(indexSearcher);
        try (UniquenessVerifier verifier = new SimpleUniquenessVerifier(partitionSearcher)) {
            verifier.verify(propertyAccessor, PROPERTY_KEY_IDS);
        }
    } finally {
        searcherManager.release(indexSearcher);
    }
}
Also used : UniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.UniquenessVerifier) SimpleUniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier) SimpleUniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier) PartitionSearcher(org.neo4j.kernel.api.impl.index.partition.PartitionSearcher)

Aggregations

PartitionSearcher (org.neo4j.kernel.api.impl.index.partition.PartitionSearcher)3 SimpleUniquenessVerifier (org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier)3 Test (org.junit.Test)1 AbstractIndexPartition (org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition)1 UniquenessVerifier (org.neo4j.kernel.api.impl.schema.verification.UniquenessVerifier)1