use of org.neo4j.shell.impl.SameJvmClient in project neo4j by neo4j.
the class TransactionGuardIntegrationTest method terminateLongRunningShellQuery.
@Test
public void terminateLongRunningShellQuery() throws Exception {
GraphDatabaseAPI database = startDatabaseWithTimeout();
GraphDatabaseShellServer shellServer = getGraphDatabaseShellServer(database);
try {
SameJvmClient client = getShellClient(shellServer);
CollectingOutput commandOutput = new CollectingOutput();
execute(shellServer, commandOutput, client.getId(), "begin Transaction");
fakeClock.forward(3, TimeUnit.SECONDS);
execute(shellServer, commandOutput, client.getId(), "create (n);");
execute(shellServer, commandOutput, client.getId(), "commit");
fail("Transaction should be already terminated.");
} catch (ShellException e) {
assertThat(e.getMessage(), containsString("Transaction timeout."));
}
assertDatabaseDoesNotHaveNodes(database);
}
use of org.neo4j.shell.impl.SameJvmClient in project neo4j by neo4j.
the class TransactionGuardIntegrationTest method getShellClient.
private SameJvmClient getShellClient(GraphDatabaseShellServer shellServer) throws ShellException, RemoteException {
SameJvmClient client = new SameJvmClient(new HashMap<>(), shellServer, new CollectingOutput(), InterruptSignalHandler.getHandler());
cleanupRule.add(client);
return client;
}
Aggregations