Skip to content

Commit 8df8443

Browse files
rahulKQLchingor13
authored andcommitted
---
yaml --- r: 32479 b: refs/heads/autosynth-firestore c: 54d1b1c h: refs/heads/master i: 32477: 061ca75 32475: 1561144 32471: 732e834 32463: bd5beed 32447: fcbed66
1 parent f7fd8c9 commit 8df8443

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

  • branches/autosynth-firestore/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
@@ -130,7 +130,7 @@ refs/heads/autosynth-containeranalysis: 18d210f81f17cf74864d0db2c29e834302f74f2a
130130
refs/heads/autosynth-datastore: f1efc3dc465174f41041acd56cf29badcec3e5bd
131131
refs/heads/autosynth-dialogflow: 73974cc32e5212aec0126472e0bc1442886fedaf
132132
refs/heads/autosynth-errorreporting: effe8001d110ad584187b30aafc473db0dd4a15f
133-
refs/heads/autosynth-firestore: cef6cd03f92eb9ac491fcb97639769fd06cde841
133+
refs/heads/autosynth-firestore: 54d1b1cfb1e6da9fcdd6c870f3bc91f402807d4a
134134
refs/heads/autosynth-iot: 4025d1804241e74d54950a324dc4f667aeaad4b3
135135
refs/heads/autosynth-kms: 6b65b0f34c12d141031c7288cdc01e550212d0f6
136136
refs/heads/autosynth-language: e73905aa7672afa47240e65b25c087207f4594f9

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