Skip to content

Commit 55b6038

Browse files
rahulKQLchingor13
authored andcommitted
---
yaml --- r: 30711 b: refs/heads/autosynth-bigquerydatatransfer c: 54d1b1c h: refs/heads/master i: 30709: c039ccc 30707: 9025a31 30703: 97365c2
1 parent ae9e5fc commit 55b6038

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

  • branches/autosynth-bigquerydatatransfer/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ refs/tags/v0.68.0: 9cc799fcf68c82ab431d425fefa58ef615ce8e5b
122122
refs/tags/v0.69.0: 78f67a29e8b9c46ba01de566a2eae0fd1c03edea
123123
refs/heads/autosynth-asset: bdb45634a0fe8f7a510692b56b31f5312e25f453
124124
refs/heads/autosynth-automl: 22f9dd5b6f5df8dbfa7da0126864d565229519b2
125-
refs/heads/autosynth-bigquerydatatransfer: cef6cd03f92eb9ac491fcb97639769fd06cde841
125+
refs/heads/autosynth-bigquerydatatransfer: 54d1b1cfb1e6da9fcdd6c870f3bc91f402807d4a
126126
refs/heads/autosynth-bigquerystorage: d2c53da3b012e38c662e4df0738042435f19365f
127127
refs/heads/autosynth-bigtable: 9e5429f45cf9face9fed585d0233534993e36b58
128128
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca

branches/autosynth-bigquerydatatransfer/google-cloud-clients/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/GCRulesTest.java

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,86 @@ public void intersectionOfUnions() {
280280
assertThat(actual.toProto()).isEqualTo(expected);
281281
}
282282

283+
@Test
284+
public void unionOfRules() {
285+
GcRule protoGCRule =
286+
GcRule.newBuilder()
287+
.setUnion(
288+
Union.newBuilder()
289+
.addRules(buildAgeRule(10, 0))
290+
.addRules(buildVersionsRule(1))
291+
.addRules(buildAgeRule(20, 2)))
292+
.build();
293+
294+
GCRules.GCRule modelGCRule =
295+
GCRULES
296+
.union()
297+
.rule(GCRULES.maxAge(Duration.ofSeconds(10)))
298+
.rule(GCRULES.maxVersions(1))
299+
.rule(GCRULES.maxAge(Duration.ofSeconds(20, 2)));
300+
assertThat(GCRULES.fromProto(protoGCRule)).isEqualTo(modelGCRule);
301+
}
302+
303+
@Test
304+
public void intersectionWithFromProto() {
305+
GcRule protoGCRule =
306+
GcRule.newBuilder()
307+
.setIntersection(
308+
Intersection.newBuilder()
309+
.addRules(buildAgeRule(10, 5))
310+
.addRules(buildVersionsRule(1))
311+
.addRules(buildVersionsRule(2)))
312+
.build();
313+
314+
GCRules.GCRule modelGCRule =
315+
GCRules.GCRULES
316+
.intersection()
317+
.rule(GCRULES.maxAge(org.threeten.bp.Duration.ofSeconds(10, 5)))
318+
.rule(GCRULES.maxVersions(1))
319+
.rule(GCRULES.maxVersions(2));
320+
assertThat(GCRULES.fromProto(protoGCRule)).isEqualTo(modelGCRule);
321+
}
322+
323+
@Test
324+
public void unionOfIntersectionFromProto() {
325+
GcRule protoGCRule =
326+
GcRule.newBuilder()
327+
.setUnion(
328+
Union.newBuilder()
329+
.addRules(
330+
GcRule.newBuilder()
331+
.setIntersection(
332+
Intersection.newBuilder()
333+
.addRules(buildVersionsRule(10))
334+
.addRules(buildAgeRule(2, 4))
335+
.build())
336+
.build())
337+
.addRules(
338+
GcRule.newBuilder()
339+
.setIntersection(
340+
Intersection.newBuilder()
341+
.addRules(buildVersionsRule(1))
342+
.addRules(buildAgeRule(1, 1))
343+
.build())
344+
.build()))
345+
.build();
346+
347+
GCRules.GCRule modelGCRule =
348+
GCRULES
349+
.union()
350+
.rule(
351+
GCRULES
352+
.intersection()
353+
.rule(GCRULES.maxVersions(10))
354+
.rule(GCRULES.maxAge(Duration.ofSeconds(2, 4))))
355+
.rule(
356+
GCRULES
357+
.intersection()
358+
.rule(GCRULES.maxVersions(1))
359+
.rule(GCRULES.maxAge(Duration.ofSeconds(1, 1))));
360+
assertThat(GCRules.GCRULES.fromProto(protoGCRule)).isEqualTo(modelGCRule);
361+
}
362+
283363
public static GcRule buildAgeRule(long seconds, int nanos) {
284364
com.google.protobuf.Duration.Builder duartionBuilder =
285365
com.google.protobuf.Duration.newBuilder();

0 commit comments

Comments
 (0)