Search in sources :

Example 91 with ToolResult

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

the class SSTableRepairedAtSetterTest method testNoArgsPrintsHelp.

@Test
public void testNoArgsPrintsHelp() {
    ToolResult tool = ToolRunner.invokeClass(SSTableRepairedAtSetter.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 92 with ToolResult

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

the class SSTableRepairedAtSetterTest method testIsunrepairedArg.

@Test
public void testIsunrepairedArg() throws Exception {
    ToolResult tool = ToolRunner.invokeClass(SSTableRepairedAtSetter.class, "--really-set", "--is-unrepaired", findOneSSTable("legacy_sstables", "legacy_ma_simple"));
    tool.assertOnCleanExit();
    assertNoUnexpectedThreadsStarted(OPTIONAL_THREADS_WITH_SCHEMA);
    assertSchemaNotLoaded();
    assertCLSMNotLoaded();
    assertSystemKSNotLoaded();
    assertKeyspaceNotLoaded();
    assertServerNotLoaded();
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 93 with ToolResult

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

the class SSTableRepairedAtSetterTest method testFilesArg.

@Test
public void testFilesArg() throws Exception {
    File tmpFile = FileUtils.createTempFile("sstablelist.txt", "tmp");
    tmpFile.deleteOnExit();
    Files.write(tmpFile.toPath(), findOneSSTable("legacy_sstables", "legacy_ma_simple").getBytes());
    String file = tmpFile.absolutePath();
    ToolResult tool = ToolRunner.invokeClass(SSTableRepairedAtSetter.class, "--really-set", "--is-repaired", "-f", file);
    tool.assertOnCleanExit();
    assertNoUnexpectedThreadsStarted(OPTIONAL_THREADS_WITH_SCHEMA);
    assertSchemaNotLoaded();
    assertCLSMNotLoaded();
    assertSystemKSNotLoaded();
    assertKeyspaceNotLoaded();
    assertServerNotLoaded();
}
Also used : File(org.apache.cassandra.io.util.File) ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 94 with ToolResult

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

the class SSTableRepairedAtSetterTest method testWrongArgFailsAndPrintsHelp.

@Test
public void testWrongArgFailsAndPrintsHelp() throws IOException {
    ToolResult tool = ToolRunner.invokeClass(SSTableRepairedAtSetter.class, "--debugwrong", findOneSSTable("legacy_sstables", "legacy_ma_simple"));
    assertThat(tool.getStdout(), CoreMatchers.containsStringIgnoringCase("usage:"));
    Assertions.assertThat(tool.getCleanedStderr()).isEmpty();
    assertEquals(1, tool.getExitCode());
}
Also used : ToolResult(org.apache.cassandra.tools.ToolRunner.ToolResult) Test(org.junit.Test)

Example 95 with ToolResult

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

the class SSTableRepairedAtSetterTest method testIsrepairedArg.

@Test
public void testIsrepairedArg() throws Exception {
    ToolResult tool = ToolRunner.invokeClass(SSTableRepairedAtSetter.class, "--really-set", "--is-repaired", findOneSSTable("legacy_sstables", "legacy_ma_simple"));
    tool.assertOnCleanExit();
    assertNoUnexpectedThreadsStarted(OPTIONAL_THREADS_WITH_SCHEMA);
    assertSchemaNotLoaded();
    assertCLSMNotLoaded();
    assertSystemKSNotLoaded();
    assertKeyspaceNotLoaded();
    assertServerNotLoaded();
}
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