Search in sources :

Example 71 with ToolResult

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

the class StandaloneSplitterWithCQLTesterTest method testMinFileSizeCheck.

@Test
public void testMinFileSizeCheck() throws Throwable {
    ToolResult tool = ToolRunner.invokeClass(StandaloneSplitter.class, sstableFileName);
    Assertions.assertThat(tool.getStdout()).contains("is less than the split size");
    assertTrue(tool.getCleanedStderr(), tool.getCleanedStderr().isEmpty());
    assertEquals(0, tool.getExitCode());
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 72 with ToolResult

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

the class StandaloneUpgraderTest method testWrongArgFailsAndPrintsHelp.

@Test
public void testWrongArgFailsAndPrintsHelp() {
    ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, "--debugwrong", "system_schema", "tables");
    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 73 with ToolResult

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

the class StandaloneUpgraderTest method testDefaultCall.

@Test
public void testDefaultCall() {
    ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, "system_schema", "tables");
    Assertions.assertThat(tool.getStdout()).isEqualTo("Found 0 sstables that need upgrading.\n");
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(0, tool.getExitCode());
    assertCorrectEnvPostTest();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 74 with ToolResult

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

the class StandaloneUpgraderTest method testFlagArgs.

@Test
public void testFlagArgs() {
    Arrays.asList("--debug", "-k", "--keep-source").forEach(arg -> {
        ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, arg, "system_schema", "tables");
        Assertions.assertThat(tool.getStdout()).as("Arg: [%s]", arg).isEqualTo("Found 0 sstables that need upgrading.\n");
        Assertions.assertThat(tool.getCleanedStderr()).as("Arg: [%s]", arg).isEmpty();
        assertEquals(0, tool.getExitCode());
        assertCorrectEnvPostTest();
    });
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 75 with ToolResult

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

the class StandaloneUpgraderTest method testHelpArg.

@Test
public void testHelpArg() {
    Arrays.asList("-h", "--help").forEach(arg -> {
        ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class, arg);
        Assertions.assertThat(tool.getStdout()).as("Arg: [%s]", arg).isNotEmpty();
        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)

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