use of com.facebook.buck.distributed.thrift.StartBuildResponse 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);
}
Aggregations