use of org.neo4j.internal.kernel.api.TokenWrite in project neo4j by neo4j.
the class UniquenessConstraintValidationIT method createConstraint.
private ConstraintDescriptor createConstraint(String label, String propertyKey) throws KernelException {
int labelId;
int propertyKeyId;
TokenWrite tokenWrite = tokenWriteInNewTransaction();
labelId = tokenWrite.labelGetOrCreateForName(label);
propertyKeyId = tokenWrite.propertyKeyGetOrCreateForName(propertyKey);
commit();
SchemaWrite schemaWrite = schemaWriteInNewTransaction();
ConstraintDescriptor constraint = schemaWrite.uniquePropertyConstraintCreate(uniqueForSchema(forLabel(labelId, propertyKeyId)));
commit();
return constraint;
}
use of org.neo4j.internal.kernel.api.TokenWrite in project neo4j by neo4j.
the class IndexIT method createIndexForAnotherLabelWhileHoldingSharedLockOnOtherLabel.
@Test
void createIndexForAnotherLabelWhileHoldingSharedLockOnOtherLabel() throws KernelException, ExecutionException, InterruptedException {
TokenWrite tokenWrite = tokenWriteInNewTransaction();
int label2 = tokenWrite.labelGetOrCreateForName("Label2");
commit();
Write write = dataWriteInNewTransaction();
long nodeId = write.nodeCreate();
write.nodeAddLabel(nodeId, label2);
try (var ignored = captureTransaction()) {
executorService.submit(() -> {
try {
schemaWriteInNewTransaction().indexCreate(schema, null);
commit();
} catch (Exception e) {
throw new RuntimeException(e);
}
}).get();
}
}
use of org.neo4j.internal.kernel.api.TokenWrite in project neo4j by neo4j.
the class SystemBuiltInProceduresIT method listPropertyKeys.
@Test
void listPropertyKeys() throws Throwable {
// Given
TokenWrite ops = tokenWriteInNewTransaction();
ops.propertyKeyGetOrCreateForName("MyProp");
commit();
try (org.neo4j.graphdb.Transaction tx = db.beginTx()) {
// When & Then
assertFalse(tx.execute("CALL db.propertyKeys").hasNext());
}
}
use of org.neo4j.internal.kernel.api.TokenWrite in project neo4j by neo4j.
the class SchemaCheckerTest method initialData.
@Override
void initialData(KernelTransaction tx) throws KernelException {
TokenWrite tokenWrite = tx.tokenWrite();
label1 = tokenWrite.labelGetOrCreateForName("A");
label2 = tokenWrite.labelGetOrCreateForName("B");
relationshipType1 = tokenWrite.relationshipTypeGetOrCreateForName("A");
relationshipType2 = tokenWrite.relationshipTypeGetOrCreateForName("B");
propertyKey1 = tokenWrite.propertyKeyGetOrCreateForName("A");
propertyKey2 = tokenWrite.propertyKeyGetOrCreateForName("B");
}
use of org.neo4j.internal.kernel.api.TokenWrite in project neo4j by neo4j.
the class SafePropertyChainReaderTest method initialData.
@Override
void initialData(KernelTransaction tx) throws KernelException {
TokenWrite tokenWrite = tx.tokenWrite();
propertyKey1 = tokenWrite.propertyKeyGetOrCreateForName("1");
propertyKey2 = tokenWrite.propertyKeyGetOrCreateForName("2");
propertyKey3 = tokenWrite.propertyKeyGetOrCreateForName("3");
}
Aggregations