Search in sources :

Example 1 with CreateBuildResponse

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);
}
Also used : CreateBuildResponse(com.facebook.buck.distributed.thrift.CreateBuildResponse) 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) Test(org.junit.Test)

Aggregations

BuildJob (com.facebook.buck.distributed.thrift.BuildJob)1 CreateBuildResponse (com.facebook.buck.distributed.thrift.CreateBuildResponse)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