APISonar


io.pravega.client.stream.RetentionPolicy.RetentionType.TIME

> io > pravega > client > stream > RetentionPolicy > RetentionType > TIME
io APIs pravega APIs client APIs stream APIs RetentionPolicy APIs RetentionType APIs TIME APIs

Example 1
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);
    }