use of io.pravega.client.stream.RetentionPolicy in project pravega by pravega.
the class ModelHelperTest method encodeRetentionPolicy.
@Test
public void encodeRetentionPolicy() {
RetentionPolicy policy1 = ModelHelper.encode(ModelHelper.decode(RetentionPolicy.bySizeBytes(1000L)));
assertEquals(RetentionPolicy.RetentionType.SIZE, policy1.getRetentionType());
assertEquals(1000L, (long) policy1.getRetentionParam());
RetentionPolicy policy2 = ModelHelper.encode(ModelHelper.decode(RetentionPolicy.byTime(Duration.ofDays(100L))));
assertEquals(RetentionPolicy.RetentionType.TIME, policy2.getRetentionType());
assertEquals(Duration.ofDays(100L).toMillis(), (long) policy2.getRetentionParam());
RetentionPolicy policy3 = ModelHelper.encode(ModelHelper.decode((RetentionPolicy) null));
assertNull(policy3);
}
Aggregations