Search in sources :

Example 41 with ToolResult

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

the class SSTableLevelResetterTest method testNoArgsPrintsHelp.

@Test
public void testNoArgsPrintsHelp() {
    ToolResult tool = ToolRunner.invokeClass(SSTableLevelResetter.class);
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(1, tool.getExitCode());
    assertNoUnexpectedThreadsStarted(null);
    assertSchemaNotLoaded();
    assertCLSMNotLoaded();
    assertSystemKSNotLoaded();
    assertKeyspaceNotLoaded();
    assertServerNotLoaded();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 42 with ToolResult

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

the class SSTableLevelResetterTest method testDefaultCall.

@Test
public void testDefaultCall() {
    ToolResult tool = ToolRunner.invokeClass(SSTableLevelResetter.class, "--really-reset", "system_schema", "tables");
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("Found no sstables,"));
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(0, tool.getExitCode());
    assertCorrectEnvPostTest();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 43 with ToolResult

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

the class SSTableOfflineRelevelTest method testMaybeChangeDocs.

@Test
public void testMaybeChangeDocs() {
    // If you added, modified options or help, please update docs if necessary
    ToolResult tool = ToolRunner.invokeClass(SSTableOfflineRelevel.class, "-h");
    String help = "This command should be run with Cassandra stopped!\n" + "Usage: sstableofflinerelevel [--dry-run] <keyspace> <columnfamily>\n";
    Assertions.assertThat(tool.getStdout()).isEqualTo(help);
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 44 with ToolResult

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

the class SSTableOfflineRelevelTest method testNoArgsPrintsHelp.

@Test
public void testNoArgsPrintsHelp() {
    ToolResult tool = ToolRunner.invokeClass(SSTableOfflineRelevel.class);
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(1, tool.getExitCode());
    assertNoUnexpectedThreadsStarted(null);
    assertSchemaNotLoaded();
    assertCLSMNotLoaded();
    assertSystemKSNotLoaded();
    assertKeyspaceNotLoaded();
    assertServerNotLoaded();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 45 with ToolResult

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

the class SSTableOfflineRelevelTest method testDryrunArg.

@Test
public void testDryrunArg() {
    ToolResult tool = ToolRunner.invokeClass(SSTableOfflineRelevel.class, "--dry-run", "system_schema", "tables");
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("No sstables to relevel for system_schema.tables"));
    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