use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneSplitterWithCQLTesterTest method testMinFileSizeCheck.
@Test
public void testMinFileSizeCheck() throws Throwable {
ToolResult tool = ToolRunner.invokeClass(StandaloneSplitter.class, sstableFileName);
Assertions.assertThat(tool.getStdout()).contains("is less than the split size");
assertTrue(tool.getCleanedStderr(), tool.getCleanedStderr().isEmpty());
assertEquals(0, tool.getExitCode());
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneUpgraderTest method testWrongArgFailsAndPrintsHelp.
@Test
public void testWrongArgFailsAndPrintsHelp() {
ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, "--debugwrong", "system_schema", "tables");
assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
assertThat(tool.getCleanedStderr(), CoreMatchers.containsStringIgnoringCase("Unrecognized option"));
assertEquals(1, tool.getExitCode());
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneUpgraderTest method testDefaultCall.
@Test
public void testDefaultCall() {
ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, "system_schema", "tables");
Assertions.assertThat(tool.getStdout()).isEqualTo("Found 0 sstables that need upgrading.\n");
Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
assertEquals(0, tool.getExitCode());
assertCorrectEnvPostTest();
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneUpgraderTest method testFlagArgs.
@Test
public void testFlagArgs() {
Arrays.asList("--debug", "-k", "--keep-source").forEach(arg -> {
ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, arg, "system_schema", "tables");
Assertions.assertThat(tool.getStdout()).as("Arg: [%s]", arg).isEqualTo("Found 0 sstables that need upgrading.\n");
Assertions.assertThat(tool.getCleanedStderr()).as("Arg: [%s]", arg).isEmpty();
assertEquals(0, tool.getExitCode());
assertCorrectEnvPostTest();
});
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class StandaloneUpgraderTest method testHelpArg.
@Test
public void testHelpArg() {
Arrays.asList("-h", "--help").forEach(arg -> {
ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, arg);
Assertions.assertThat(tool.getStdout()).as("Arg: [%s]", arg).isNotEmpty();
Assertions.assertThat(tool.getCleanedStderr()).as("Arg: [%s]", arg).isEmpty();
tool.assertOnExitCode();
assertCorrectEnvPostTest();
});
}
Aggregations