use of org.neo4j.shell.impl.CollectingOutput in project neo4j by neo4j.
the class AppsIT method canDisableWelcomeMessage.
@Test
public void canDisableWelcomeMessage() throws Exception {
Map<String, Serializable> values = genericMap("quiet", "true");
final CollectingOutput out = new CollectingOutput();
ShellClient client = new SameJvmClient(values, shellServer, out);
client.shutdown();
final String outString = out.asString();
assertEquals("Shows welcome message: " + outString, false, outString.contains("Welcome to the Neo4j Shell! Enter 'help' for a list of commands"));
}
use of org.neo4j.shell.impl.CollectingOutput in project neo4j by neo4j.
the class AppsIT method doesShowWelcomeMessage.
@Test
public void doesShowWelcomeMessage() throws Exception {
Map<String, Serializable> values = genericMap();
final CollectingOutput out = new CollectingOutput();
ShellClient client = new SameJvmClient(values, shellServer, out);
client.shutdown();
final String outString = out.asString();
assertEquals("Shows welcome message: " + outString, true, outString.contains("Welcome to the Neo4j Shell! Enter 'help' for a list of commands"));
}
use of org.neo4j.shell.impl.CollectingOutput in project neo4j by neo4j.
the class AbstractShellIT method executeCommand.
public void executeCommand(ShellClient client, String command, String... theseLinesMustExistRegEx) throws Exception {
CollectingOutput output = new CollectingOutput();
client.evaluate(command, output);
for (String lineThatMustExist : theseLinesMustExistRegEx) {
boolean negative = lineThatMustExist.startsWith("!");
lineThatMustExist = negative ? lineThatMustExist.substring(1) : lineThatMustExist;
Pattern pattern = compile(lineThatMustExist);
boolean found = false;
for (String line : output) {
if (pattern.matcher(line).find()) {
found = true;
break;
}
}
assertTrue("Was expecting a line matching '" + lineThatMustExist + "', but didn't find any from out of " + Iterables.asCollection(output), found != negative);
}
}
use of org.neo4j.shell.impl.CollectingOutput in project neo4j by neo4j.
the class AbstractShellIT method executeCommandExpectingException.
public void executeCommandExpectingException(String command, String errorMessageShouldContain) throws Exception {
CollectingOutput output = new CollectingOutput();
try {
shellClient.evaluate(command, output);
fail("Was expecting an exception");
} catch (ShellException e) {
String errorMessage = e.getMessage();
if (!errorMessage.toLowerCase().contains(errorMessageShouldContain.toLowerCase())) {
fail("Error message '" + errorMessage + "' should have contained '" + errorMessageShouldContain + "'");
}
}
}
use of org.neo4j.shell.impl.CollectingOutput in project neo4j by neo4j.
the class TransactionGuardIntegrationTest method terminateLongRunningShellPeriodicCommitQuery.
@Test
public void terminateLongRunningShellPeriodicCommitQuery() throws Exception {
GraphDatabaseAPI database = startDatabaseWithTimeoutCustomGuard();
GraphDatabaseShellServer shellServer = getGraphDatabaseShellServer(database);
try {
SameJvmClient client = getShellClient(shellServer);
CollectingOutput commandOutput = new CollectingOutput();
URL url = prepareTestImportFile(8);
execute(shellServer, commandOutput, client.getId(), "USING PERIODIC COMMIT 5 LOAD CSV FROM '" + url + "' AS line CREATE ();");
fail("Transaction should be already terminated.");
} catch (ShellException e) {
assertThat(e.getMessage(), containsString("Transaction timeout."));
}
assertDatabaseDoesNotHaveNodes(database);
}
Aggregations