use of org.neo4j.token.api.NamedToken in project neo4j by neo4j.
the class TokenRegistryTest method getTokenInternalMustNotFindPublicTokens.
@Test
void getTokenInternalMustNotFindPublicTokens() {
registry.put(new NamedToken(INBOUND1_TYPE, 1));
assertThat(registry.getTokenInternal(1)).isNull();
}
use of org.neo4j.token.api.NamedToken in project neo4j by neo4j.
the class TokenRegistryTest method putAllMustNotThrowWhenPublicTokenDuplicatesNameOfInternalToken.
@Test
void putAllMustNotThrowWhenPublicTokenDuplicatesNameOfInternalToken() {
registry.put(new NamedToken(INBOUND1_TYPE, 1, true));
registry.putAll(singletonList(new NamedToken(INBOUND1_TYPE, 2)));
}
use of org.neo4j.token.api.NamedToken in project neo4j by neo4j.
the class EntityValueUpdatesTest method propertyLoader.
private static StorageReader propertyLoader(StorageProperty... properties) {
StubStorageCursors stub = new StubStorageCursors();
for (StorageProperty property : properties) {
stub.propertyKeyTokenHolder().addToken(new NamedToken(String.valueOf(property.propertyKeyId()), property.propertyKeyId()));
}
Map<String, Value> propertyMap = new HashMap<>();
for (StorageProperty p : properties) {
propertyMap.put(String.valueOf(p.propertyKeyId()), p.value());
}
stub.withNode(ENTITY_ID).properties(propertyMap);
stub.withRelationship(ENTITY_ID, 1, 1, 2).properties(propertyMap);
return stub;
}
use of org.neo4j.token.api.NamedToken in project neo4j by neo4j.
the class SchemaStore method insertPropertyIntoMap.
private static void insertPropertyIntoMap(PropertyKeyValue propertyKeyValue, Map<String, Value> props, TokenHolders tokenHolders) throws MalformedSchemaRuleException {
try {
NamedToken propertyKeyTokenName = tokenHolders.propertyKeyTokens().getInternalTokenById(propertyKeyValue.propertyKeyId());
props.put(propertyKeyTokenName.name(), propertyKeyValue.value());
} catch (TokenNotFoundException | InvalidRecordException e) {
int id = propertyKeyValue.propertyKeyId();
throw new MalformedSchemaRuleException("Cannot read schema rule because it is referring to a property key token (id " + id + ") that does not exist.", e);
}
}
use of org.neo4j.token.api.NamedToken in project neo4j by neo4j.
the class RelationshipTest method shouldBeAbleToReferToIdsBeyondMaxInt.
@Test
void shouldBeAbleToReferToIdsBeyondMaxInt() {
// GIVEN
var transaction = mock(InternalTransaction.class, RETURNS_DEEP_STUBS);
when(transaction.newNodeEntity(anyLong())).then(invocation -> nodeWithId(invocation.getArgument(0)));
when(transaction.getRelationshipTypeById(anyInt())).then(invocation -> new NamedToken("whatever", invocation.getArgument(0)));
long[] ids = new long[] { 1437589437, 2047587483, 2147496246L, 2147342921, 3276473721L, 4762746373L, 57587348738L, 59892898932L };
int[] types = new int[] { 0, 10, 101, 3024, 20123, 45008 };
// WHEN/THEN
for (int i = 0; i < ids.length - 2; i++) {
long id = ids[i];
long nodeId1 = ids[i + 1];
long nodeId2 = ids[i + 2];
int type = types[i];
verifyIds(transaction, id, nodeId1, type, nodeId2);
verifyIds(transaction, id, nodeId2, type, nodeId1);
}
}
Aggregations