Search in sources :

Example 1 with ShellConnectionInfo

use of org.neo4j.kernel.impl.query.clientconnection.ShellConnectionInfo in project neo4j by neo4j.

the class Start method createTransactionContext.

private TransactionalContext createTransactionContext(String queryText, Map<String, Object> queryParameters, Session session) {
    DependencyResolver dependencyResolver = getDependencyResolver();
    GraphDatabaseQueryService graph = dependencyResolver.resolveDependency(GraphDatabaseQueryService.class);
    TransactionalContextFactory contextFactory = Neo4jTransactionalContextFactory.create(graph, new PropertyContainerLocker());
    InternalTransaction transaction = graph.beginTransaction(KernelTransaction.Type.implicit, SecurityContext.AUTH_DISABLED);
    return contextFactory.newContext(new ShellConnectionInfo(session.getId()), transaction, queryText, queryParameters);
}
Also used : PropertyContainerLocker(org.neo4j.kernel.impl.coreapi.PropertyContainerLocker) ShellConnectionInfo(org.neo4j.kernel.impl.query.clientconnection.ShellConnectionInfo) GraphDatabaseQueryService(org.neo4j.kernel.GraphDatabaseQueryService) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) TransactionalContextFactory(org.neo4j.kernel.impl.query.TransactionalContextFactory) Neo4jTransactionalContextFactory(org.neo4j.kernel.impl.query.Neo4jTransactionalContextFactory) DependencyResolver(org.neo4j.graphdb.DependencyResolver)

Example 2 with ShellConnectionInfo

use of org.neo4j.kernel.impl.query.clientconnection.ShellConnectionInfo in project neo4j by neo4j.

the class ClientConnectionInfoTest method connectionDetailsForShellSession.

@Test
public void connectionDetailsForShellSession() throws Exception {
    // given
    ClientConnectionInfo clientConnection = new ShellConnectionInfo(1).withUsername("FULL");
    // when
    String connectionDetails = clientConnection.asConnectionDetails();
    // then
    assertEquals("shell-session\tshell\t1\tFULL", connectionDetails);
}
Also used : ClientConnectionInfo(org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo) ShellConnectionInfo(org.neo4j.kernel.impl.query.clientconnection.ShellConnectionInfo) Test(org.junit.Test)

Aggregations

ShellConnectionInfo (org.neo4j.kernel.impl.query.clientconnection.ShellConnectionInfo)2 Test (org.junit.Test)1 DependencyResolver (org.neo4j.graphdb.DependencyResolver)1 GraphDatabaseQueryService (org.neo4j.kernel.GraphDatabaseQueryService)1 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)1 PropertyContainerLocker (org.neo4j.kernel.impl.coreapi.PropertyContainerLocker)1 Neo4jTransactionalContextFactory (org.neo4j.kernel.impl.query.Neo4jTransactionalContextFactory)1 TransactionalContextFactory (org.neo4j.kernel.impl.query.TransactionalContextFactory)1 ClientConnectionInfo (org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo)1