use of org.neo4j.kernel.impl.query.clientconnection.BoltConnectionInfo in project neo4j-documentation by neo4j.
the class DocsExecutionEngineTest method createTransactionalContext.
private static TransactionalContext createTransactionalContext(String query) {
InternalTransaction transaction = database.beginTransaction(Type.implicit, SecurityContext.AUTH_DISABLED);
BoltConnectionInfo boltConnection = new BoltConnectionInfo("username", "neo4j-java-bolt-driver", new InetSocketAddress("127.0.0.1", 56789), new InetSocketAddress("127.0.0.1", 7687));
return contextFactory.newContext(boltConnection, transaction, query, EMPTY_MAP);
}
use of org.neo4j.kernel.impl.query.clientconnection.BoltConnectionInfo in project neo4j by neo4j.
the class TransactionStateMachineSPI method executeQuery.
@Override
public BoltResultHandle executeQuery(BoltQuerySource querySource, SecurityContext securityContext, String statement, Map<String, Object> params, ThrowingAction<KernelException> onFail) throws QueryExecutionKernelException {
InternalTransaction internalTransaction = queryService.beginTransaction(implicit, securityContext);
ClientConnectionInfo sourceDetails = new BoltConnectionInfo(querySource.principalName, querySource.clientName, querySource.connectionDescriptor.clientAddress, querySource.connectionDescriptor.serverAddress);
TransactionalContext transactionalContext = contextFactory.newContext(sourceDetails, internalTransaction, statement, params);
return new BoltResultHandle() {
@Override
public BoltResult start() throws KernelException {
try {
Result run = queryExecutionEngine.executeQuery(statement, params, transactionalContext);
return new CypherAdapterStream(run, clock);
} catch (KernelException e) {
onFail.apply();
throw new QueryExecutionKernelException(e);
} catch (Throwable e) {
onFail.apply();
throw e;
}
}
@Override
public void terminate() {
transactionalContext.terminate();
}
};
}
use of org.neo4j.kernel.impl.query.clientconnection.BoltConnectionInfo in project neo4j by neo4j.
the class ClientConnectionInfoTest method connectionDetailsForBoltQuerySource.
@Test
void connectionDetailsForBoltQuerySource() {
// given
ClientConnectionInfo clientConnection = new BoltConnectionInfo("bolt-42", "neo4j-java-bolt-driver", new InetSocketAddress("127.0.0.1", 56789), new InetSocketAddress("127.0.0.1", 7687));
// when
String connectionDetails = clientConnection.asConnectionDetails();
// then
assertEquals("bolt-session\tbolt\tneo4j-java-bolt-driver\t\tclient/127.0.0.1:56789\t" + "server/127.0.0.1:7687>", connectionDetails);
}
Aggregations