use of org.neo4j.common.TokenNameLookup in project neo4j by neo4j.
the class PropertyDeleterTest method startStore.
private void startStore(boolean log) {
Config config = Config.defaults(GraphDatabaseInternalSettings.log_inconsistent_data_deletion, log);
idGeneratorFactory = new DefaultIdGeneratorFactory(directory.getFileSystem(), immediate(), "db");
neoStores = new StoreFactory(DatabaseLayout.ofFlat(directory.homePath()), config, idGeneratorFactory, pageCache, directory.getFileSystem(), NullLogProvider.getInstance(), PageCacheTracer.NULL, writable()).openAllNeoStores(true);
propertyStore = neoStores.getPropertyStore();
propertyCreator = new PropertyCreator(propertyStore, traverser, NULL, INSTANCE);
deleter = new PropertyDeleter(traverser, this.neoStores, new TokenNameLookup() {
@Override
public String labelGetName(int labelId) {
return "" + labelId;
}
@Override
public String relationshipTypeGetName(int relationshipTypeId) {
return "" + relationshipTypeId;
}
@Override
public String propertyKeyGetName(int propertyKeyId) {
return "" + propertyKeyId;
}
}, logProvider, config, NULL, INSTANCE);
}
use of org.neo4j.common.TokenNameLookup in project neo4j by neo4j.
the class SchemaStorageTest method shouldThrowExceptionOnNodeDuplicateRuleFound.
@Test
void shouldThrowExceptionOnNodeDuplicateRuleFound() {
TokenNameLookup tokenNameLookup = getDefaultTokenNameLookup();
SchemaStorage schemaStorageSpy = Mockito.spy(storage);
when(schemaStorageSpy.streamAllSchemaRules(false, NULL)).thenReturn(Stream.of(getUniquePropertyConstraintRule(1L, LABEL1_ID, PROP1_ID), getUniquePropertyConstraintRule(2L, LABEL1_ID, PROP1_ID)));
var e = assertThrows(DuplicateSchemaRuleException.class, () -> schemaStorageSpy.constraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(LABEL1_ID, PROP1_ID), NULL));
assertThat(e, tokenNameLookup).hasUserMessage("Multiple label uniqueness constraints found for (:Label1 {prop1}).");
}
use of org.neo4j.common.TokenNameLookup in project neo4j by neo4j.
the class SchemaStorageTest method getDefaultTokenNameLookup.
private static TokenNameLookup getDefaultTokenNameLookup() {
TokenNameLookup tokenNameLookup = mock(TokenNameLookup.class);
when(tokenNameLookup.labelGetName(LABEL1_ID)).thenReturn(LABEL1);
when(tokenNameLookup.propertyKeyGetName(PROP1_ID)).thenReturn(PROP1);
when(tokenNameLookup.relationshipTypeGetName(TYPE1_ID)).thenReturn(TYPE1);
when(tokenNameLookup.entityTokensGetNames(EntityType.NODE, new int[] { LABEL1_ID })).thenReturn(new String[] { LABEL1 });
when(tokenNameLookup.entityTokensGetNames(EntityType.RELATIONSHIP, new int[] { TYPE1_ID })).thenReturn(new String[] { TYPE1 });
return tokenNameLookup;
}
use of org.neo4j.common.TokenNameLookup in project neo4j by neo4j.
the class SchemaStorageTest method shouldThrowExceptionOnNodeRuleNotFound.
@Test
void shouldThrowExceptionOnNodeRuleNotFound() {
TokenNameLookup tokenNameLookup = getDefaultTokenNameLookup();
var e = assertThrows(SchemaRuleNotFoundException.class, () -> storage.constraintsGetSingle(ConstraintDescriptorFactory.existsForLabel(LABEL1_ID, PROP1_ID), NULL));
assertThat(e, tokenNameLookup).hasUserMessage("No label property existence constraint was found for (:Label1 {prop1}).");
}
Aggregations