Search in sources :

Example 81 with ToolResult

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

the class SSTableExpiredBlockersTest method testWrongArgsIgnored.

@Test
public void testWrongArgsIgnored() {
    ToolResult tool = ToolRunner.invokeClass(SSTableExpiredBlockers.class, "--debugwrong", "system_schema", "tables");
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("No sstables for"));
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(1, tool.getExitCode());
    assertCorrectEnvPostTest();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 82 with ToolResult

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

the class SSTableExportTest method testPKArgOutOfOrder.

@Test
public void testPKArgOutOfOrder() {
    ToolResult tool = ToolRunner.invokeClass(SSTableExport.class, "-k", "0", sstable);
    assertThat(tool.getStdout(), containsStringIgnoringCase("usage:"));
    assertThat(tool.getCleanedStderr(), containsStringIgnoringCase("You must supply exactly one sstable"));
    assertThat(tool.getCleanedStderr(), containsStringIgnoringCase("before the -k/-x options"));
    assertEquals(1, tool.getExitCode());
    assertPostTestEnv();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 83 with ToolResult

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

the class SSTableExportTest method testWrongArgFailsAndPrintsHelp.

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

Example 84 with ToolResult

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

the class SSTableExportTest method testMaybeChangeDocs.

@Test
public void testMaybeChangeDocs() {
    // If you added, modified options or help, please update docs if necessary
    ToolResult tool = ToolRunner.invokeClass(SSTableExport.class);
    String help = "usage: sstabledump <sstable file path> <options>\n" + "                   \n" + "Dump contents of given SSTable to standard output in JSON format.\n" + " -d         CQL row per line internal representation\n" + " -e         enumerate partition keys only\n" + " -k <arg>   List of included partition keys\n" + " -l         Output json lines, by partition\n" + " -t         Print raw timestamps instead of iso8601 date strings\n" + " -x <arg>   List of excluded partition keys\n";
    Assertions.assertThat(tool.getStdout()).isEqualTo(help);
    assertPostTestEnv();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 85 with ToolResult

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

the class SSTableExportTest method testNoArgsPrintsHelp.

@Test
public void testNoArgsPrintsHelp() {
    ToolResult tool = ToolRunner.invokeClass(SSTableExport.class);
    assertThat(tool.getStdout(), containsStringIgnoringCase("usage:"));
    assertThat(tool.getCleanedStderr(), containsStringIgnoringCase("You must supply exactly one sstable"));
    assertThat(tool.getCleanedStderr(), not(containsStringIgnoringCase("before the -k/-x options")));
    assertEquals(1, tool.getExitCode());
    assertPostTestEnv();
}
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