Search in sources :

Example 6 with StreamConfig

use of io.pravega.controller.stream.api.grpc.v1.Controller.StreamConfig in project pravega by pravega.

the class ModelHelperTest method decodeStreamConfig.

@Test
public void decodeStreamConfig() {
    StreamConfig config = ModelHelper.decode(StreamConfiguration.builder().scope("scope").streamName("test").scalingPolicy(ScalingPolicy.byEventRate(100, 2, 3)).retentionPolicy(RetentionPolicy.byTime(Duration.ofDays(100L))).build());
    assertEquals("test", config.getStreamInfo().getStream());
    Controller.ScalingPolicy policy = config.getScalingPolicy();
    assertEquals(Controller.ScalingPolicy.ScalingPolicyType.BY_RATE_IN_EVENTS_PER_SEC, policy.getScaleType());
    assertEquals(100L, policy.getTargetRate());
    assertEquals(2, policy.getScaleFactor());
    assertEquals(3, policy.getMinNumSegments());
    Controller.RetentionPolicy retentionPolicy = config.getRetentionPolicy();
    assertEquals(Controller.RetentionPolicy.RetentionPolicyType.TIME, retentionPolicy.getRetentionType());
    assertEquals(Duration.ofDays(100L).toMillis(), retentionPolicy.getRetentionParam());
}
Also used : StreamConfig(io.pravega.controller.stream.api.grpc.v1.Controller.StreamConfig) Controller(io.pravega.controller.stream.api.grpc.v1.Controller) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)4 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)4 CreateScopeStatus (io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus)4 DeleteScopeStatus (io.pravega.controller.stream.api.grpc.v1.Controller.DeleteScopeStatus)4 Map (java.util.Map)3 Before (org.junit.Before)3 Lists (com.google.common.collect.Lists)2 Exceptions (io.pravega.common.Exceptions)2 State (io.pravega.controller.store.stream.tables.State)2 Controller (io.pravega.controller.stream.api.grpc.v1.Controller)2 StreamConfig (io.pravega.controller.stream.api.grpc.v1.Controller.StreamConfig)2 AssertExtensions (io.pravega.test.common.AssertExtensions)2 TestingServerStarter (io.pravega.test.common.TestingServerStarter)2 AbstractMap (java.util.AbstractMap)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 List (java.util.List)2 Optional (java.util.Optional)2