Search in sources :

Example 96 with ToolResult

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

the class SSTableRepairedAtSetterTest method testMaybeChangeDocs.

@Test
public void testMaybeChangeDocs() {
    // If you added, modified options or help, please update docs if necessary
    ToolResult tool = ToolRunner.invokeClass(SSTableRepairedAtSetter.class, "-h");
    String help = "This command should be run with Cassandra stopped, otherwise you will get very strange behavior\n" + "Verify that Cassandra is not running and then execute the command like this:\n" + "Usage: sstablerepairedset --really-set [--is-repaired | --is-unrepaired] [-f <sstable-list> | <sstables>]\n";
    Assertions.assertThat(tool.getStdout()).isEqualTo(help);
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 97 with ToolResult

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

the class StandaloneSSTableUtilTest method testCleanupArg.

@Test
public void testCleanupArg() {
    Arrays.asList("-c", "--cleanup").forEach(arg -> {
        ToolResult tool = ToolRunner.invokeClass(StandaloneSSTableUtil.class, arg, "system_schema", "tables");
        assertThat("Arg: [" + arg + "]", tool.getStdout(), CoreMatchers.containsStringIgnoringCase("Cleaning up..."));
        Assertions.assertThat(tool.getCleanedStderr()).as("Arg: [%s]", arg).isEmpty();
        tool.assertOnExitCode();
        assertCorrectEnvPostTest();
    });
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 98 with ToolResult

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

the class StandaloneSSTableUtilTest method testHelpArg.

@Test
public void testHelpArg() {
    Arrays.asList("-h", "--help").forEach(arg -> {
        ToolResult tool = ToolRunner.invokeClass(StandaloneSSTableUtil.class, arg);
        assertThat("Arg: [" + arg + "]", tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
        Assertions.assertThat(tool.getCleanedStderr()).as("Arg: [%s]", arg).isEmpty();
        tool.assertOnExitCode();
        assertCorrectEnvPostTest();
    });
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 99 with ToolResult

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

the class StandaloneSSTableUtilTest method testListFilesArgs.

@Test
public void testListFilesArgs() {
    Arrays.asList("-d", "--debug", "-o", "-oplog", "-v", "--verbose").forEach(arg -> {
        ToolResult tool = ToolRunner.invokeClass(StandaloneSSTableUtil.class, arg, "system_schema", "tables");
        Assertions.assertThat(tool.getStdout()).as("Arg: [%s]", arg).isEqualTo("Listing files...\n");
        Assertions.assertThat(tool.getCleanedStderr()).as("Arg: [%s]", arg).isEmpty();
        tool.assertOnExitCode();
        assertCorrectEnvPostTest();
    });
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 100 with ToolResult

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

the class StandaloneSplitterTest method testMaybeChangeDocs.

@Test
public void testMaybeChangeDocs() {
    // If you added, modified options or help, please update docs if necessary
    ToolResult tool = ToolRunner.invokeClass(StandaloneSplitter.class, "-h");
    String help = "usage: sstablessplit [options] <filename> [<filename>]*\n" + "--\n" + "Split the provided sstables files in sstables of maximum provided file\n" + "size (see option --size).\n" + "--\n" + "Options are:\n" + "    --debug         display stack traces\n" + " -h,--help          display this help message\n" + "    --no-snapshot   don't snapshot the sstables before splitting\n" + " -s,--size <size>   maximum size in MB for the output sstables (default:\n" + "                    50)\n";
    Assertions.assertThat(tool.getStdout()).isEqualTo(help);
}
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