Search in sources :

Example 11 with RetentionPolicy

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);
}
Also used : RetentionPolicy(io.pravega.client.stream.RetentionPolicy) Test(org.junit.Test)

Aggregations

RetentionPolicy (io.pravega.client.stream.RetentionPolicy)11 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)9 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)7 Test (org.junit.Test)7 HashMap (java.util.HashMap)4 AtomicReference (java.util.concurrent.atomic.AtomicReference)4 StreamCutRecord (io.pravega.controller.store.stream.StreamCutRecord)3 List (java.util.List)3 CompletionException (java.util.concurrent.CompletionException)3 Collectors (java.util.stream.Collectors)3 Preconditions (com.google.common.base.Preconditions)2 Exceptions (io.pravega.common.Exceptions)2 Futures (io.pravega.common.concurrent.Futures)2 ControllerEventStreamWriterMock (io.pravega.controller.mocks.ControllerEventStreamWriterMock)2 TaskExceptions (io.pravega.controller.server.eventProcessor.requesthandlers.TaskExceptions)2 BucketChangeListener (io.pravega.controller.server.retention.BucketChangeListener)2 StreamTruncationRecord (io.pravega.controller.store.stream.tables.StreamTruncationRecord)2 Config (io.pravega.controller.util.Config)2 UpdateStreamEvent (io.pravega.shared.controller.event.UpdateStreamEvent)2 CompletableFuture (java.util.concurrent.CompletableFuture)2