Search in sources :

Example 36 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class StandaloneSplitterTest method testWrongArgFailsAndPrintsHelp.

@Test
public void testWrongArgFailsAndPrintsHelp() {
    ToolResult tool = ToolRunner.invokeClass(StandaloneSplitter.class, "--debugwrong", "mockFile");
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
    assertThat(tool.getCleanedStderr(), CoreMatchers.containsStringIgnoringCase("Unrecognized option"));
    assertEquals(1, tool.getExitCode());
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 37 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class SetGetEntireSSTableInterDCStreamThroughputTest method assertGetThroughput.

private static void assertGetThroughput(int expected) {
    ToolResult tool = invokeNodetool("getinterdcstreamthroughput", "-e");
    tool.assertOnCleanExit();
    if (expected > 0)
        assertThat(tool.getStdout()).contains("Current entire SSTable inter-datacenter stream throughput: " + expected + " MiB/s");
    else
        assertThat(tool.getStdout()).contains("Current entire SSTable inter-datacenter stream throughput: unlimited");
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult)

Example 38 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class AuditLogViewerTest method testNoArgs.

@Test
public void testNoArgs() {
    ToolResult tool = ToolRunner.invoke(toolPath);
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
    assertThat(tool.getCleanedStderr(), CoreMatchers.containsStringIgnoringCase("Audit log files directory path is a required argument."));
    assertEquals(1, tool.getExitCode());
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 39 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class CompactionStressTest method testWriteAndCompact.

@Test
public void testWriteAndCompact() {
    ClassLoader classLoader = getClass().getClassLoader();
    File file = new File(classLoader.getResource("blogpost.yaml").getFile());
    String profileFile = file.absolutePath();
    ToolResult tool = ToolRunner.invokeClass("org.apache.cassandra.stress.CompactionStress", "write", "-d", "build/test/cassandra", "-g", "0", "-p", profileFile, "-t", "4");
    tool.assertOnCleanExit();
    tool = ToolRunner.invokeClass("org.apache.cassandra.stress.CompactionStress", "compact", "-d", "build/test/cassandra", "-p", profileFile, "-t", "4");
    tool.assertOnCleanExit();
}
Also used : File(org.apache.cassandra.io.util.File) ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 40 with ToolResult

use of org.apache.cassandra.tools.ToolRunner.ToolResult in project cassandra by apache.

the class SSTableLevelResetterTest method testMissingSecurityFlagCall.

@Test
public void testMissingSecurityFlagCall() {
    ToolResult tool = ToolRunner.invokeClass(SSTableLevelResetter.class, "system_schema", "tables");
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(1, tool.getExitCode());
    assertCorrectEnvPostTest();
}
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