Search in sources :

Example 26 with ToolResult

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);
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult)

Example 27 with ToolResult

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);
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult)

Example 28 with ToolResult

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();
    });
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 29 with ToolResult

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());
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 30 with ToolResult

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();
    });
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Aggregations

ToolResult (org.apache.cassandra.tools.ToolRunner.ToolResult)123 Test (org.junit.Test)102 File (org.apache.cassandra.io.util.File)4 NoHostAvailableException (com.datastax.driver.core.exceptions.NoHostAvailableException)3 RandomAccessFile (java.io.RandomAccessFile)3 LegacySSTableTest (org.apache.cassandra.io.sstable.LegacySSTableTest)3 SSTableReader (org.apache.cassandra.io.sstable.format.SSTableReader)2 Session (com.datastax.driver.core.Session)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)1 Keyspace (org.apache.cassandra.db.Keyspace)1 Cluster (org.apache.cassandra.distributed.Cluster)1 IInvokableInstance (org.apache.cassandra.distributed.api.IInvokableInstance)1 Ignore (org.junit.Ignore)1