Search in sources :

Example 6 with UnionRule

use of com.google.cloud.bigtable.admin.v2.models.GCRules.UnionRule in project java-bigtable by googleapis.

the class GCRulesTest method unionOfIntersections.

@Test
public void unionOfIntersections() {
    UnionRule actual = GCRULES.union().rule(GCRULES.intersection().rule(GCRULES.maxVersions(1)).rule(GCRULES.maxAge(Duration.ofSeconds(1)))).rule(GCRULES.intersection().rule(GCRULES.maxVersions(1)).rule(GCRULES.maxAge(Duration.ofSeconds(1))));
    GcRule expected = GcRule.newBuilder().setUnion(Union.newBuilder().addRules(GcRule.newBuilder().setIntersection(Intersection.newBuilder().addRules(buildVersionsRule(1)).addRules(buildAgeRule(1, 0)))).addRules(GcRule.newBuilder().setIntersection(Intersection.newBuilder().addRules(buildVersionsRule(1)).addRules(buildAgeRule(1, 0))))).build();
    assertEquals(2, actual.getRulesList().size());
    assertThat(actual.toProto()).isEqualTo(expected);
}
Also used : GcRule(com.google.bigtable.admin.v2.GcRule) UnionRule(com.google.cloud.bigtable.admin.v2.models.GCRules.UnionRule) Test(org.junit.Test)

Aggregations

UnionRule (com.google.cloud.bigtable.admin.v2.models.GCRules.UnionRule)6 DurationRule (com.google.cloud.bigtable.admin.v2.models.GCRules.DurationRule)4 Test (org.junit.Test)4 IntersectionRule (com.google.cloud.bigtable.admin.v2.models.GCRules.IntersectionRule)3 VersionRule (com.google.cloud.bigtable.admin.v2.models.GCRules.VersionRule)3 ModifyColumnFamiliesRequest (com.google.cloud.bigtable.admin.v2.models.ModifyColumnFamiliesRequest)3 AlreadyExistsException (com.google.api.gax.rpc.AlreadyExistsException)2 GcRule (com.google.bigtable.admin.v2.GcRule)1 ColumnFamily (com.google.cloud.bigtable.admin.v2.models.ColumnFamily)1 Table (com.google.cloud.bigtable.admin.v2.models.Table)1 ByteString (com.google.protobuf.ByteString)1