use of com.facebook.buck.distributed.thrift.BuildJob 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);
}
use of com.facebook.buck.distributed.thrift.BuildJob in project buck by facebook.
the class DistBuildServiceTest method canStartBuild.
@Test
public void canStartBuild() throws Exception {
final String idString = "start id";
Capture<FrontendRequest> request = EasyMock.newCapture();
FrontendResponse response = new FrontendResponse();
response.setType(FrontendRequestType.START_BUILD);
StartBuildResponse startBuildResponse = new StartBuildResponse();
BuildJob buildJob = new BuildJob();
StampedeId stampedeId = new StampedeId();
stampedeId.setId(idString);
buildJob.setStampedeId(stampedeId);
startBuildResponse.setBuildJob(buildJob);
response.setStartBuildResponse(startBuildResponse);
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.startBuild(id);
Assert.assertEquals(request.getValue().getType(), FrontendRequestType.START_BUILD);
Assert.assertTrue(request.getValue().isSetStartBuildRequest());
Assert.assertTrue(request.getValue().getStartBuildRequest().isSetStampedeId());
Assert.assertEquals(request.getValue().getStartBuildRequest().getStampedeId(), id);
Assert.assertTrue(job.isSetStampedeId());
Assert.assertEquals(job.getStampedeId(), id);
}
use of com.facebook.buck.distributed.thrift.BuildJob in project buck by facebook.
the class ThriftUtilTest method createBuildJob.
private BuildJob createBuildJob() {
BuildJob job = new BuildJob();
job.setStatus(BuildStatus.FINISHED_SUCCESSFULLY);
StampedeId stampedeId = new StampedeId();
stampedeId.setId("all will be well");
job.setStampedeId(stampedeId);
return job;
}
use of com.facebook.buck.distributed.thrift.BuildJob in project buck by facebook.
the class DistBuildService method getCurrentBuildJobState.
public BuildJob getCurrentBuildJobState(StampedeId id) throws IOException {
BuildStatusRequest statusRequest = new BuildStatusRequest();
statusRequest.setStampedeId(id);
FrontendRequest request = new FrontendRequest();
request.setType(FrontendRequestType.BUILD_STATUS);
request.setBuildStatusRequest(statusRequest);
FrontendResponse response = makeRequestChecked(request);
BuildJob job = response.getBuildStatusResponse().getBuildJob();
Preconditions.checkState(job.getStampedeId().equals(id));
return job;
}
Aggregations