use of com.google.cloud.storage.BucketInfo.IsLiveDeleteRule in project google-cloud-java by GoogleCloudPlatform.
the class BucketInfoTest method testDeleteRules.
@Test
public void testDeleteRules() {
AgeDeleteRule ageRule = new AgeDeleteRule(10);
assertEquals(10, ageRule.getDaysToLive());
assertEquals(10, ageRule.getDaysToLive());
assertEquals(Type.AGE, ageRule.getType());
assertEquals(Type.AGE, ageRule.getType());
CreatedBeforeDeleteRule createBeforeRule = new CreatedBeforeDeleteRule(1);
assertEquals(1, createBeforeRule.getTimeMillis());
assertEquals(1, createBeforeRule.getTimeMillis());
assertEquals(Type.CREATE_BEFORE, createBeforeRule.getType());
NumNewerVersionsDeleteRule versionsRule = new NumNewerVersionsDeleteRule(2);
assertEquals(2, versionsRule.getNumNewerVersions());
assertEquals(2, versionsRule.getNumNewerVersions());
assertEquals(Type.NUM_NEWER_VERSIONS, versionsRule.getType());
IsLiveDeleteRule isLiveRule = new IsLiveDeleteRule(true);
assertTrue(isLiveRule.isLive());
assertEquals(Type.IS_LIVE, isLiveRule.getType());
assertEquals(Type.IS_LIVE, isLiveRule.getType());
Rule rule = new Rule().set("a", "b");
RawDeleteRule rawRule = new RawDeleteRule(rule);
assertEquals(Type.IS_LIVE, isLiveRule.getType());
assertEquals(Type.IS_LIVE, isLiveRule.getType());
ImmutableList<DeleteRule> rules = ImmutableList.of(ageRule, createBeforeRule, versionsRule, isLiveRule, rawRule);
for (DeleteRule delRule : rules) {
assertEquals(delRule, DeleteRule.fromPb(delRule.toPb()));
}
}
Aggregations