Skip to content

Commit ac4410d

Browse files
rahulKQLchingor13
authored andcommitted
---
yaml --- r: 31517 b: refs/heads/autosynth-containeranalysis c: 54d1b1c h: refs/heads/master i: 31515: 608af81
1 parent 6fa5fe7 commit ac4410d

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

  • branches/autosynth-containeranalysis/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
@@ -126,7 +126,7 @@ refs/heads/autosynth-bigquerydatatransfer: 71b6b6d2a992d05999b53e6e130c4fc1c8c8b
126126
refs/heads/autosynth-bigquerystorage: a345f72d7a6358e9fea9dcdae94ec85a27da3088
127127
refs/heads/autosynth-bigtable: 2a6af7e2959fd79c99b8ca5d773f29a6434b546d
128128
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
129-
refs/heads/autosynth-containeranalysis: cef6cd03f92eb9ac491fcb97639769fd06cde841
129+
refs/heads/autosynth-containeranalysis: 54d1b1cfb1e6da9fcdd6c870f3bc91f402807d4a
130130
refs/heads/autosynth-datastore: d0fc1187000c7a50d8bddd89c3b7cdf1187ecb96
131131
refs/heads/autosynth-dialogflow: 841930a680ebe370c9fc6ae824465f6bc51a5a46
132132
refs/heads/autosynth-errorreporting: 3f176c20b55dfaaa8fc32f28d82b31784b93e636

branches/autosynth-containeranalysis/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)