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