use of com.facebook.buck.distributed.thrift.CreateBuildResponse in project buck by facebook.
the class DistBuildServiceTest method canCreateBuild.
@Test
public void canCreateBuild() throws Exception {
final String idString = "create id";
Capture<FrontendRequest> request = EasyMock.newCapture();
FrontendResponse response = new FrontendResponse();
response.setType(FrontendRequestType.CREATE_BUILD);
CreateBuildResponse createBuildResponse = new CreateBuildResponse();
BuildJob buildJob = new BuildJob();
StampedeId stampedeId = new StampedeId();
stampedeId.setId(idString);
buildJob.setStampedeId(stampedeId);
createBuildResponse.setBuildJob(buildJob);
response.setCreateBuildResponse(createBuildResponse);
response.setWasSuccessful(true);
EasyMock.expect(frontendService.makeRequest(EasyMock.capture(request))).andReturn(response).once();
EasyMock.replay(frontendService);
BuildJob job = distBuildService.createBuild();
Assert.assertEquals(request.getValue().getType(), FrontendRequestType.CREATE_BUILD);
Assert.assertTrue(request.getValue().isSetCreateBuildRequest());
Assert.assertTrue(request.getValue().getCreateBuildRequest().isSetCreateTimestampMillis());
Assert.assertTrue(job.isSetStampedeId());
Assert.assertTrue(job.getStampedeId().isSetId());
Assert.assertEquals(job.getStampedeId().getId(), idString);
}
Aggregations