use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class SetGetEntireSSTableInterDCStreamThroughputTest method assertSetInvalidThroughput.
private static void assertSetInvalidThroughput(String throughput, String expectedErrorMessage) {
ToolResult tool = throughput == null ? invokeNodetool("setinterdcstreamthroughput", "-e") : invokeNodetool("setinterdcstreamthroughput", "-e", throughput);
assertThat(tool.getExitCode()).isEqualTo(1);
assertThat(tool.getStdout()).contains(expectedErrorMessage);
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class SetGetInterDCStreamThroughputTest method assertSetInvalidThroughput.
private static void assertSetInvalidThroughput(String throughput, String expectedErrorMessage) {
ToolResult tool = throughput == null ? invokeNodetool("setinterdcstreamthroughput") : invokeNodetool("setinterdcstreamthroughput", throughput);
assertThat(tool.getExitCode()).isEqualTo(1);
assertThat(tool.getStdout()).contains(expectedErrorMessage);
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class SSTableMetadataViewerTest method testColorArg.
@Test
public void testColorArg() {
Arrays.asList("-c", "--colors").stream().forEach(arg -> {
ToolResult tool = ToolRunner.invokeClass(SSTableMetadataViewer.class, arg, sstable);
Assertions.assertThat(tool.getStdout()).contains(Util.BLUE);
Assertions.assertThat(tool.getStdout()).contains(sstable.replaceAll("-Data\\.db$", ""));
assertTrue("Arg: [" + arg + "]\n" + tool.getStderr(), tool.getStderr().isEmpty());
assertEquals(0, tool.getExitCode());
assertGoodEnvPostTest();
});
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class SSTableMetadataViewerTest method testWrongArgFailsAndPrintsHelp.
@Test
public void testWrongArgFailsAndPrintsHelp() {
ToolResult tool = ToolRunner.invokeClass(SSTableMetadataViewer.class, "--debugwrong", "sstableFile");
assertTrue(tool.getStdout(), tool.getStdout().isEmpty());
assertThat(tool.getCleanedStderr(), CoreMatchers.containsStringIgnoringCase("Options:"));
assertEquals(1, tool.getExitCode());
}
use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.
the class SSTableMetadataViewerTest method testUnicodeArg.
@Test
public void testUnicodeArg() {
Arrays.asList("-u", "--unicode").stream().forEach(arg -> {
ToolResult tool = ToolRunner.invokeClass(SSTableMetadataViewer.class, arg, sstable);
assertTrue(tool.getStdout(), !CharMatcher.ascii().matchesAllOf(tool.getStdout()));
Assertions.assertThat(tool.getStdout()).contains(sstable.replaceAll("-Data\\.db$", ""));
assertTrue("Arg: [" + arg + "]\n" + tool.getStderr(), tool.getStderr().isEmpty());
assertEquals(0, tool.getExitCode());
assertGoodEnvPostTest();
});
}
Aggregations