Search in sources :

Example 11 with UpdateStreamStatus

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

the class ControllerServiceImplTest method deleteStreamTests.

@Test
public void deleteStreamTests() {
    CreateScopeStatus createScopeStatus;
    CreateStreamStatus createStreamStatus;
    DeleteStreamStatus deleteStreamStatus;
    final StreamConfiguration configuration1 = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(4)).build();
    // Create a test scope.
    ResultObserver<CreateScopeStatus> result1 = new ResultObserver<>();
    this.controllerService.createScope(ModelHelper.createScopeInfo(SCOPE1), result1);
    createScopeStatus = result1.get();
    assertEquals("Create Scope", CreateScopeStatus.Status.SUCCESS, createScopeStatus.getStatus());
    // Try deleting a non-existent stream.
    ResultObserver<DeleteStreamStatus> result2 = new ResultObserver<>();
    this.controllerService.deleteStream(ModelHelper.createStreamInfo(SCOPE3, "dummyStream"), result2);
    deleteStreamStatus = result2.get();
    assertEquals("Delete Non-existent stream", DeleteStreamStatus.Status.STREAM_NOT_FOUND, deleteStreamStatus.getStatus());
    // Try deleting a non-existent stream.
    ResultObserver<DeleteStreamStatus> result3 = new ResultObserver<>();
    this.controllerService.deleteStream(ModelHelper.createStreamInfo("dummyScope", "dummyStream"), result3);
    deleteStreamStatus = result3.get();
    assertEquals("Delete Non-existent stream", DeleteStreamStatus.Status.STREAM_NOT_FOUND, deleteStreamStatus.getStatus());
    // Create a test stream.
    ResultObserver<CreateStreamStatus> result4 = new ResultObserver<>();
    this.controllerService.createStream(ModelHelper.decode(SCOPE1, STREAM1, configuration1), result4);
    createStreamStatus = result4.get();
    Assert.assertEquals("Create stream", CreateStreamStatus.Status.SUCCESS, createStreamStatus.getStatus());
    // Try deleting the test stream without sealing it first.
    ResultObserver<DeleteStreamStatus> result5 = new ResultObserver<>();
    this.controllerService.deleteStream(ModelHelper.createStreamInfo(SCOPE1, STREAM1), result5);
    deleteStreamStatus = result5.get();
    assertEquals("Delete non-sealed stream", DeleteStreamStatus.Status.STREAM_NOT_SEALED, deleteStreamStatus.getStatus());
    // Seal the test stream.
    ResultObserver<UpdateStreamStatus> result6 = new ResultObserver<>();
    this.controllerService.sealStream(ModelHelper.createStreamInfo(SCOPE1, STREAM1), result6);
    UpdateStreamStatus updateStreamStatus = result6.get();
    assertEquals("Seal stream", UpdateStreamStatus.Status.SUCCESS, updateStreamStatus.getStatus());
    // Delete the sealed stream.
    ResultObserver<DeleteStreamStatus> result7 = new ResultObserver<>();
    this.controllerService.deleteStream(ModelHelper.createStreamInfo(SCOPE1, STREAM1), result7);
    deleteStreamStatus = result7.get();
    assertEquals("Delete sealed stream", DeleteStreamStatus.Status.SUCCESS, deleteStreamStatus.getStatus());
}
Also used : UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) DeleteStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteStreamStatus) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Test(org.junit.Test)

Example 12 with UpdateStreamStatus

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

the class ControllerServiceImplTest method updateSealedStreamTest.

@Test
public void updateSealedStreamTest() {
    CreateScopeStatus createScopeStatus;
    CreateStreamStatus createStreamStatus;
    UpdateStreamStatus updateStreamStatus;
    final StreamConfiguration configuration1 = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(4)).build();
    // Create a test scope.
    ResultObserver<CreateScopeStatus> result1 = new ResultObserver<>();
    this.controllerService.createScope(ModelHelper.createScopeInfo(SCOPE1), result1);
    createScopeStatus = result1.get();
    assertEquals("Create Scope", CreateScopeStatus.Status.SUCCESS, createScopeStatus.getStatus());
    // Create a test stream.
    ResultObserver<CreateStreamStatus> result2 = new ResultObserver<>();
    this.controllerService.createStream(ModelHelper.decode(SCOPE1, STREAM1, configuration1), result2);
    createStreamStatus = result2.get();
    Assert.assertEquals("Create stream", CreateStreamStatus.Status.SUCCESS, createStreamStatus.getStatus());
    // Seal the test stream.
    ResultObserver<UpdateStreamStatus> result3 = new ResultObserver<>();
    this.controllerService.sealStream(ModelHelper.createStreamInfo(SCOPE1, STREAM1), result3);
    updateStreamStatus = result3.get();
    assertEquals("Seal stream", UpdateStreamStatus.Status.SUCCESS, updateStreamStatus.getStatus());
    // Update the sealed test stream.
    ResultObserver<UpdateStreamStatus> result4 = new ResultObserver<>();
    final StreamConfiguration configuration = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(1)).build();
    this.controllerService.updateStream(ModelHelper.decode(SCOPE1, STREAM1, configuration), result4);
    updateStreamStatus = result4.get();
    assertEquals("Update sealed stream", UpdateStreamStatus.Status.STREAM_SEALED, updateStreamStatus.getStatus());
}
Also used : UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Test(org.junit.Test)

Example 13 with UpdateStreamStatus

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

the class ControllerServiceImplTest method sealStreamTests.

@Test
public void sealStreamTests() {
    CreateScopeStatus createScopeStatus;
    CreateStreamStatus createStreamStatus;
    UpdateStreamStatus updateStreamStatus;
    final StreamConfiguration configuration1 = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(4)).build();
    // Create a test scope.
    ResultObserver<CreateScopeStatus> result1 = new ResultObserver<>();
    this.controllerService.createScope(ModelHelper.createScopeInfo(SCOPE1), result1);
    createScopeStatus = result1.get();
    assertEquals("Create Scope", CreateScopeStatus.Status.SUCCESS, createScopeStatus.getStatus());
    // Create a test stream.
    ResultObserver<CreateStreamStatus> result2 = new ResultObserver<>();
    this.controllerService.createStream(ModelHelper.decode(SCOPE1, STREAM1, configuration1), result2);
    createStreamStatus = result2.get();
    assertEquals("Create stream", CreateStreamStatus.Status.SUCCESS, createStreamStatus.getStatus());
    // Seal a test stream.
    ResultObserver<UpdateStreamStatus> result3 = new ResultObserver<>();
    this.controllerService.sealStream(ModelHelper.createStreamInfo(SCOPE1, STREAM1), result3);
    updateStreamStatus = result3.get();
    assertEquals("Seal Stream", UpdateStreamStatus.Status.SUCCESS, updateStreamStatus.getStatus());
    // Seal a non-existent stream.
    ResultObserver<UpdateStreamStatus> result4 = new ResultObserver<>();
    this.controllerService.sealStream(ModelHelper.createStreamInfo(SCOPE1, "dummyStream"), result4);
    updateStreamStatus = result4.get();
    assertEquals("Seal non-existent stream", UpdateStreamStatus.Status.STREAM_NOT_FOUND, updateStreamStatus.getStatus());
    // Seal a non-existent stream.
    ResultObserver<UpdateStreamStatus> result5 = new ResultObserver<>();
    this.controllerService.sealStream(ModelHelper.createStreamInfo("dummyScope", STREAM1), result5);
    updateStreamStatus = result5.get();
    assertEquals("Seal non-existent stream", UpdateStreamStatus.Status.STREAM_NOT_FOUND, updateStreamStatus.getStatus());
}
Also used : UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Test(org.junit.Test)

Example 14 with UpdateStreamStatus

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

the class ControllerServiceImplTest method truncateStreamTests.

@Test
public void truncateStreamTests() {
    CreateScopeStatus createScopeStatus;
    CreateStreamStatus createStreamStatus;
    final StreamConfiguration configuration1 = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(4)).build();
    // Create a test scope.
    ResultObserver<CreateScopeStatus> result1 = new ResultObserver<>();
    this.controllerService.createScope(ModelHelper.createScopeInfo(SCOPE1), result1);
    createScopeStatus = result1.get();
    assertEquals("Create Scope", CreateScopeStatus.Status.SUCCESS, createScopeStatus.getStatus());
    // Create a test stream.
    ResultObserver<CreateStreamStatus> result2 = new ResultObserver<>();
    this.controllerService.createStream(ModelHelper.decode(SCOPE1, STREAM1, configuration1), result2);
    createStreamStatus = result2.get();
    assertEquals("Create stream", CreateStreamStatus.Status.SUCCESS, createStreamStatus.getStatus());
    // Truncate the stream
    ResultObserver<UpdateStreamStatus> result3 = new ResultObserver<>();
    this.controllerService.truncateStream(Controller.StreamCut.newBuilder().setStreamInfo(StreamInfo.newBuilder().setScope(SCOPE1).setStream(STREAM1).build()).putCut(0, 0).putCut(1, 0).putCut(2, 0).putCut(3, 0).build(), result3);
    UpdateStreamStatus truncateStreamStatus = result3.get();
    assertEquals(UpdateStreamStatus.Status.SUCCESS, truncateStreamStatus.getStatus());
}
Also used : UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Test(org.junit.Test)

Example 15 with UpdateStreamStatus

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

the class ControllerServiceImplTest method updateStreamTestsWithTags.

@Test
public void updateStreamTestsWithTags() {
    createScopeAndStream(SCOPE1, STREAM1, ScalingPolicy.fixed(2));
    final StreamConfiguration configuration2 = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(2)).tag("tag1").tag("tag2").build();
    ResultObserver<UpdateStreamStatus> result2 = new ResultObserver<>();
    this.controllerService.updateStream(ModelHelper.decode(SCOPE1, STREAM1, configuration2), result2);
    UpdateStreamStatus updateStreamStatus = result2.get();
    Assert.assertEquals(updateStreamStatus.getStatus(), UpdateStreamStatus.Status.SUCCESS);
    // Update stream for non-existent stream.
    ResultObserver<UpdateStreamStatus> result3 = new ResultObserver<>();
    final StreamConfiguration configuration3 = StreamConfiguration.builder().scalingPolicy(ScalingPolicy.fixed(1)).build();
    this.controllerService.updateStream(ModelHelper.decode(SCOPE1, "unknownstream", configuration3), result3);
    updateStreamStatus = result3.get();
    Assert.assertEquals(UpdateStreamStatus.Status.STREAM_NOT_FOUND, updateStreamStatus.getStatus());
}
Also used : UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Test(org.junit.Test)

Aggregations

UpdateStreamStatus (io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus)15 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)14 CreateScopeStatus (io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus)12 CreateStreamStatus (io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus)12 Test (org.junit.Test)11 DeleteStreamStatus (io.pravega.controller.stream.api.grpc.v1.Controller.DeleteStreamStatus)6 CreateTxnRequest (io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnRequest)4 DeleteScopeStatus (io.pravega.controller.stream.api.grpc.v1.Controller.DeleteScopeStatus)4 GetSegmentsRequest (io.pravega.controller.stream.api.grpc.v1.Controller.GetSegmentsRequest)4 NodeUri (io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri)4 PingTxnRequest (io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest)4 PingTxnStatus (io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus)4 ScaleRequest (io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest)4 ScaleResponse (io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse)4 Segment (io.pravega.client.segment.impl.Segment)3 ScaleStatusRequest (io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusRequest)3 ScaleStatusResponse (io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusResponse)3 ScopeInfo (io.pravega.controller.stream.api.grpc.v1.Controller.ScopeInfo)3 SegmentId (io.pravega.controller.stream.api.grpc.v1.Controller.SegmentId)3 SegmentRanges (io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRanges)3