use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class SchemaTransactionStateTest method addedRulesShouldBeVisibleInTx.
@Test
public void addedRulesShouldBeVisibleInTx() throws Exception {
// GIVEN
commitNoLabels();
// WHEN
NewIndexDescriptor rule1 = indexCreate(txContext, state, labelId1, key1);
NewIndexDescriptor rule2 = indexCreate(txContext, state, labelId2, key2);
// THEN
assertEquals(asSet(rule1), Iterators.asSet(txContext.indexesGetForLabel(state, labelId1)));
verify(store).indexesGetForLabel(labelId1);
assertEquals(asSet(rule2), Iterators.asSet(txContext.indexesGetForLabel(state, labelId2)));
verify(store).indexesGetForLabel(labelId2);
assertEquals(asSet(rule1, rule2), Iterators.asSet(txContext.indexesGetAll(state)));
verify(store).indexesGetAll();
verifyNoMoreInteractions(store);
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class SchemaTransactionStateTest method shouldReturnNonExistentRuleAddedInTransactionFromLookup.
@Test
public void shouldReturnNonExistentRuleAddedInTransactionFromLookup() throws Exception {
// GIVEN
// -- the store already have an index on the label and a different property
NewIndexDescriptor existingRule1 = NewIndexDescriptorFactory.forLabel(labelId1, key1);
when(indexGetForLabelAndPropertyKey(store, labelId1, key1)).thenReturn(existingRule1);
// -- the store already have an index on a different label with the same property
NewIndexDescriptor existingRule2 = NewIndexDescriptorFactory.forLabel(labelId2, key2);
when(indexGetForLabelAndPropertyKey(store, labelId2, key2)).thenReturn(existingRule2);
// -- a non-existent index has been added in the transaction
indexCreate(txContext, state, labelId1, key2);
// WHEN
NewIndexDescriptor index = indexGetForLabelAndPropertyKey(txContext, state, labelId1, key2);
// THEN
assertEquals(NewIndexDescriptorFactory.forLabel(labelId1, key2), index);
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class SchemaTransactionStateTest method addedAdditionalRuleShouldBeVisibleInTx.
@Test
public void addedAdditionalRuleShouldBeVisibleInTx() throws Exception {
// GIVEN
commitNoLabels();
// WHEN
NewIndexDescriptor rule1 = indexCreate(txContext, state, labelId1, key1);
NewIndexDescriptor rule2 = indexCreate(txContext, state, labelId1, key2);
// THEN
assertEquals(asSet(rule1, rule2), Iterators.asSet(txContext.indexesGetForLabel(state, labelId1)));
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class SchemaTransactionStateTest method addedRuleShouldBeVisibleInTx.
@Test
public void addedRuleShouldBeVisibleInTx() throws Exception {
// GIVEN
commitNoLabels();
// WHEN
NewIndexDescriptor index = indexCreate(txContext, state, labelId1, key1);
// THEN
assertEquals(asSet(index), Iterators.asSet(txContext.indexesGetForLabel(state, labelId1)));
verify(store).indexesGetForLabel(labelId1);
assertEquals(asSet(index), Iterators.asSet(txContext.indexesGetAll(state)));
verify(store).indexesGetAll();
verifyNoMoreInteractions(store);
}
use of org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor in project neo4j by neo4j.
the class SchemaCacheTest method shouldReturnNullWhenNoIndexExists.
@Test
public void shouldReturnNullWhenNoIndexExists() {
// Given
SchemaCache schemaCache = newSchemaCache();
// When
NewIndexDescriptor indexDescriptor = schemaCache.indexDescriptor(SchemaDescriptorFactory.forLabel(1, 1));
// Then
assertNull(indexDescriptor);
}
Aggregations