protected Transaction newTransaction( LoginContext loginContext ) throws TransactionFailureException { transaction = kernel.beginTransaction( implicit, loginContext ); return transaction; }
public IndexDescriptor createConstraintIndex( final SchemaDescriptor schema, String provider ) { try ( Transaction transaction = kernelSupplier.get().beginTransaction( implicit, AUTH_DISABLED ) ) { IndexDescriptor index = ((KernelTransaction) transaction).indexUniqueCreate( schema, provider ); transaction.success(); return index; } catch ( TransactionFailureException | SchemaKernelException e ) { throw new RuntimeException( e ); } } }
protected Transaction beginTransaction() throws TransactionFailureException { Kernel kernel = testSupport.kernelToTest(); return kernel.beginTransaction( Transaction.Type.implicit, LoginContext.AUTH_DISABLED ); }
protected SchemaWrite schemaWriteInNewTransaction() throws KernelException { transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ); return transaction.schemaWrite(); }
protected Transaction beginTransaction() throws TransactionFailureException { Kernel kernel = testSupport.kernelToTest(); return kernel.beginTransaction( Transaction.Type.implicit, LoginContext.AUTH_DISABLED ); }
private void newTransaction() throws KernelException { if ( transaction != null ) { fail( "tx already opened" ); } transaction = kernel.beginTransaction( KernelTransaction.Type.implicit, LoginContext.AUTH_DISABLED ); }
protected TokenWrite tokenWriteInNewTransaction() throws KernelException { transaction = kernel.beginTransaction( implicit, AnonymousContext.writeToken() ); return transaction.tokenWrite(); }
protected Procedures procsSchema() throws TransactionFailureException { transaction = kernel.beginTransaction( KernelTransaction.Type.implicit, AnonymousContext.full() ); return transaction.procedures(); }
private void awaitSchemaStateCleared( String keyForProbing ) throws TransactionFailureException { try ( Transaction transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { while ( transaction.schemaRead().schemaStateGetOrCreate( keyForProbing, ignored -> null ) != null ) { LockSupport.parkNanos( MILLISECONDS.toNanos( 10 ) ); } transaction.success(); } }
protected Procedures procs() throws TransactionFailureException { transaction = kernel.beginTransaction( implicit, AnonymousContext.read() ); return transaction.procedures(); }
private String commitToSchemaState( String key, String value ) throws TransactionFailureException { try ( Transaction transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { String result = getOrCreateFromState( transaction, key, value ); transaction.success(); return result; } }
private Transaction transaction() throws TransactionFailureException { DependencyResolver resolver = this.db.getDependencyResolver(); return resolver.resolveDependency( Kernel.class ).beginTransaction( implicit, LoginContext.AUTH_DISABLED ); }
private int getPropertyKeyForName( String name ) throws TransactionFailureException { try ( Transaction tx = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { int result = tx.tokenRead().propertyKey( name ); tx.success(); return result; } }
private void dropConstraint( ConstraintDescriptor descriptor ) throws KernelException { try ( Transaction transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { transaction.schemaWrite().constraintDrop( descriptor ); transaction.success(); } }
private void dropIndex( IndexReference reference ) throws KernelException { try ( Transaction transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { transaction.schemaWrite().indexDrop( reference ); transaction.success(); } }
public int getNumberOfNodes() { Kernel kernel = database.getGraph().getDependencyResolver().resolveDependency( Kernel.class ); try ( org.neo4j.internal.kernel.api.Transaction tx = kernel.beginTransaction( implicit, AnonymousContext.read() ) ) { return Math.toIntExact( tx.dataRead().nodesGetCount() ); } catch ( TransactionFailureException e ) { throw new RuntimeException( e ); } }
public int getNumberOfRelationships() { Kernel kernel = database.getGraph().getDependencyResolver().resolveDependency( Kernel.class ); try ( org.neo4j.internal.kernel.api.Transaction tx = kernel.beginTransaction( implicit, AnonymousContext.read() ) ) { return Math.toIntExact( tx.dataRead().relationshipsGetCount() ); } catch ( TransactionFailureException e ) { throw new RuntimeException( e ); } }
private IndexReference createIndex() throws KernelException { try ( Transaction transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { IndexReference reference = transaction.schemaWrite().indexCreate( SchemaDescriptorFactory.forLabel( 1, 1 ) ); transaction.success(); return reference; } }
private ConstraintDescriptor createConstraint() throws KernelException { try ( Transaction transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { ConstraintDescriptor descriptor = transaction.schemaWrite().uniquePropertyConstraintCreate( SchemaDescriptorFactory.forLabel( 1, 1 ) ); transaction.success(); return descriptor; } }
private void awaitIndexOnline( IndexReference descriptor, String keyForProbing ) throws IndexNotFoundKernelException, TransactionFailureException { try ( Transaction transaction = kernel.beginTransaction( implicit, AUTH_DISABLED ) ) { SchemaIndexTestHelper.awaitIndexOnline( transaction.schemaRead(), descriptor ); transaction.success(); } awaitSchemaStateCleared( keyForProbing ); }