Search in sources :

Example 16 with GcRule

use of com.google.bigtable.admin.v2.GcRule in project java-bigtable by googleapis.

the class GCRulesTest method intersectionOne.

@Test
public void intersectionOne() {
    GcRule actual = GCRULES.intersection().rule(GCRULES.maxVersions(1)).toProto();
    GcRule expected = buildVersionsRule(1);
    assertThat(actual).isEqualTo(expected);
}
Also used : GcRule(com.google.bigtable.admin.v2.GcRule) Test(org.junit.Test)

Example 17 with GcRule

use of com.google.bigtable.admin.v2.GcRule 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)

Example 18 with GcRule

use of com.google.bigtable.admin.v2.GcRule in project java-bigtable by googleapis.

the class GCRulesTest method unionOfRules.

@Test
public void unionOfRules() {
    GcRule protoGCRule = GcRule.newBuilder().setUnion(Union.newBuilder().addRules(buildAgeRule(10, 0)).addRules(buildVersionsRule(1)).addRules(buildAgeRule(20, 2))).build();
    GCRules.GCRule modelGCRule = GCRULES.union().rule(GCRULES.maxAge(Duration.ofSeconds(10))).rule(GCRULES.maxVersions(1)).rule(GCRULES.maxAge(Duration.ofSeconds(20, 2)));
    assertThat(GCRULES.fromProto(protoGCRule)).isEqualTo(modelGCRule);
}
Also used : GcRule(com.google.bigtable.admin.v2.GcRule) Test(org.junit.Test)

Example 19 with GcRule

use of com.google.bigtable.admin.v2.GcRule in project java-bigtable by googleapis.

the class GCRulesTest method unionEmpty.

@Test
public void unionEmpty() {
    GcRule actual = GCRULES.union().toProto();
    GcRule expected = GcRule.newBuilder().build();
    assertThat(actual).isEqualTo(expected);
}
Also used : GcRule(com.google.bigtable.admin.v2.GcRule) Test(org.junit.Test)

Example 20 with GcRule

use of com.google.bigtable.admin.v2.GcRule in project java-bigtable by googleapis.

the class GCRulesTest method unionOfIntersectionFromProto.

@Test
public void unionOfIntersectionFromProto() {
    GcRule protoGCRule = GcRule.newBuilder().setUnion(Union.newBuilder().addRules(GcRule.newBuilder().setIntersection(Intersection.newBuilder().addRules(buildVersionsRule(10)).addRules(buildAgeRule(2, 4)).build()).build()).addRules(GcRule.newBuilder().setIntersection(Intersection.newBuilder().addRules(buildVersionsRule(1)).addRules(buildAgeRule(1, 1)).build()).build())).build();
    GCRules.GCRule modelGCRule = GCRULES.union().rule(GCRULES.intersection().rule(GCRULES.maxVersions(10)).rule(GCRULES.maxAge(Duration.ofSeconds(2, 4)))).rule(GCRULES.intersection().rule(GCRULES.maxVersions(1)).rule(GCRULES.maxAge(Duration.ofSeconds(1, 1))));
    assertThat(GCRules.GCRULES.fromProto(protoGCRule)).isEqualTo(modelGCRule);
}
Also used : GcRule(com.google.bigtable.admin.v2.GcRule) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)24 GcRule (com.google.bigtable.admin.v2.GcRule)21 ColumnFamily (com.google.bigtable.admin.v2.ColumnFamily)4 GCRule (com.google.cloud.bigtable.admin.v2.models.GCRules.GCRule)3 Table (com.google.bigtable.admin.v2.Table)2 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)2 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)2 GCRules (com.google.cloud.bigtable.admin.v2.models.GCRules)1 DurationRule (com.google.cloud.bigtable.admin.v2.models.GCRules.DurationRule)1 IntersectionRule (com.google.cloud.bigtable.admin.v2.models.GCRules.IntersectionRule)1 UnionRule (com.google.cloud.bigtable.admin.v2.models.GCRules.UnionRule)1 VersionRule (com.google.cloud.bigtable.admin.v2.models.GCRules.VersionRule)1 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)1