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());
}
Aggregations