Search in sources :

Example 6 with WarningsSnapshot

use of org.apache.cassandra.service.reads.trackwarnings.WarningsSnapshot in project cassandra by apache.

the class WarningsSnapshotTest method mergeNonEmpty2.

@Test
public void mergeNonEmpty2() {
    WarningsSnapshot a = builder().tombstonesAbort(ImmutableSet.of(HOME), 42).build();
    WarningsSnapshot b = builder().localReadSizeWarning(ImmutableSet.of(VACATION_HOME), 12).build();
    WarningsSnapshot expected = builder().tombstonesAbort(ImmutableSet.of(HOME), 42).localReadSizeWarning(ImmutableSet.of(VACATION_HOME), 12).build();
    // validate builder to protect against empty = empty passing this test
    assertThat(a.tombstones.aborts.instances).isEqualTo(expected.tombstones.aborts.instances).isEqualTo(ImmutableSet.of(HOME));
    assertThat(a.tombstones.aborts.maxValue).isEqualTo(expected.tombstones.aborts.maxValue).isEqualTo(42);
    assertThat(b.localReadSize.warnings.instances).isEqualTo(expected.localReadSize.warnings.instances).isEqualTo(ImmutableSet.of(VACATION_HOME));
    assertThat(b.localReadSize.warnings.maxValue).isEqualTo(expected.localReadSize.warnings.maxValue).isEqualTo(12);
    WarningsSnapshot output = a.merge(b);
    assertThat(output).isEqualTo(expected).isEqualTo(expected.merge(empty()));
    assertThat(output.merge(expected)).isEqualTo(expected);
}
Also used : WarningsSnapshot(org.apache.cassandra.service.reads.trackwarnings.WarningsSnapshot) Test(org.junit.Test)

Aggregations

WarningsSnapshot (org.apache.cassandra.service.reads.trackwarnings.WarningsSnapshot)6 Test (org.junit.Test)5 ReadFailureException (org.apache.cassandra.exceptions.ReadFailureException)1 ReadTimeoutException (org.apache.cassandra.exceptions.ReadTimeoutException)1 WarningContext (org.apache.cassandra.service.reads.trackwarnings.WarningContext)1