Search in sources :

Example 1 with BuildStatusResponse

use of com.facebook.buck.distributed.thrift.BuildStatusResponse in project buck by facebook.

the class DistBuildServiceTest method canPollBuild.

@Test
public void canPollBuild() throws Exception {
    final String idString = "poll id";
    Capture<FrontendRequest> request = EasyMock.newCapture();
    FrontendResponse response = new FrontendResponse();
    response.setType(FrontendRequestType.BUILD_STATUS);
    BuildStatusResponse buildStatusResponse = new BuildStatusResponse();
    BuildJob buildJob = new BuildJob();
    StampedeId stampedeId = new StampedeId();
    stampedeId.setId(idString);
    buildJob.setStampedeId(stampedeId);
    buildStatusResponse.setBuildJob(buildJob);
    response.setBuildStatusResponse(buildStatusResponse);
    response.setWasSuccessful(true);
    EasyMock.expect(frontendService.makeRequest(EasyMock.capture(request))).andReturn(response).once();
    EasyMock.replay(frontendService);
    StampedeId id = new StampedeId();
    id.setId(idString);
    BuildJob job = distBuildService.getCurrentBuildJobState(id);
    Assert.assertEquals(request.getValue().getType(), FrontendRequestType.BUILD_STATUS);
    Assert.assertTrue(request.getValue().isSetBuildStatusRequest());
    Assert.assertTrue(request.getValue().getBuildStatusRequest().isSetStampedeId());
    Assert.assertEquals(request.getValue().getBuildStatusRequest().getStampedeId(), id);
    Assert.assertTrue(job.isSetStampedeId());
    Assert.assertEquals(job.getStampedeId(), id);
}
Also used : StampedeId(com.facebook.buck.distributed.thrift.StampedeId) FrontendResponse(com.facebook.buck.distributed.thrift.FrontendResponse) FrontendRequest(com.facebook.buck.distributed.thrift.FrontendRequest) BuildJob(com.facebook.buck.distributed.thrift.BuildJob) BuildStatusResponse(com.facebook.buck.distributed.thrift.BuildStatusResponse) Test(org.junit.Test)

Aggregations

BuildJob (com.facebook.buck.distributed.thrift.BuildJob)1 BuildStatusResponse (com.facebook.buck.distributed.thrift.BuildStatusResponse)1 FrontendRequest (com.facebook.buck.distributed.thrift.FrontendRequest)1 FrontendResponse (com.facebook.buck.distributed.thrift.FrontendResponse)1 StampedeId (com.facebook.buck.distributed.thrift.StampedeId)1 Test (org.junit.Test)1