Search in sources :

Example 1 with UniquenessVerifier

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

the class SimpleUniquenessVerifierTest method assertDuplicatesCreated.

private void assertDuplicatesCreated(PropertyAccessor propertyAccessor, List<Object> updatedPropertyValues) {
    try (UniquenessVerifier verifier = newSimpleUniquenessVerifier()) {
        verifier.verify(propertyAccessor, PROPERTY_KEY_IDS, updatedPropertyValues);
        fail("Uniqueness verification was successful. This is not expected...");
    } catch (Throwable t) {
        assertThat(t, instanceOf(IndexEntryConflictException.class));
    }
}
Also used : UniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.UniquenessVerifier) SimpleUniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier)

Example 2 with UniquenessVerifier

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

the class SimpleUniquenessVerifierTest method assertHasDuplicates.

private void assertHasDuplicates(PropertyAccessor propertyAccessor) {
    try (UniquenessVerifier verifier = newSimpleUniquenessVerifier()) {
        verifier.verify(propertyAccessor, PROPERTY_KEY_IDS);
        fail("Uniqueness verification was successful. This is not expected...");
    } catch (Throwable t) {
        assertThat(t, instanceOf(IndexEntryConflictException.class));
    }
}
Also used : UniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.UniquenessVerifier) SimpleUniquenessVerifier(org.neo4j.kernel.api.impl.schema.verification.SimpleUniquenessVerifier)

Example 3 with UniquenessVerifier

use of org.neo4j.kernel.api.impl.schema.verification.UniquenessVerifier 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

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