Search in sources :

Example 6 with BuildJob

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

Example 7 with BuildJob

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

Example 8 with BuildJob

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;
}
Also used : StampedeId(com.facebook.buck.distributed.thrift.StampedeId) BuildJob(com.facebook.buck.distributed.thrift.BuildJob)

Example 9 with BuildJob

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;
}
Also used : FrontendResponse(com.facebook.buck.distributed.thrift.FrontendResponse) FrontendRequest(com.facebook.buck.distributed.thrift.FrontendRequest) BuildStatusRequest(com.facebook.buck.distributed.thrift.BuildStatusRequest) BuildJob(com.facebook.buck.distributed.thrift.BuildJob)

Aggregations

BuildJob (com.facebook.buck.distributed.thrift.BuildJob)9 StampedeId (com.facebook.buck.distributed.thrift.StampedeId)6 FrontendRequest (com.facebook.buck.distributed.thrift.FrontendRequest)5 FrontendResponse (com.facebook.buck.distributed.thrift.FrontendResponse)5 Test (org.junit.Test)4 DistBuildService (com.facebook.buck.distributed.DistBuildService)1 BuildStatusRequest (com.facebook.buck.distributed.thrift.BuildStatusRequest)1 BuildStatusResponse (com.facebook.buck.distributed.thrift.BuildStatusResponse)1 CreateBuildResponse (com.facebook.buck.distributed.thrift.CreateBuildResponse)1 LogLineBatchRequest (com.facebook.buck.distributed.thrift.LogLineBatchRequest)1 MultiGetBuildSlaveLogDirResponse (com.facebook.buck.distributed.thrift.MultiGetBuildSlaveLogDirResponse)1 MultiGetBuildSlaveRealTimeLogsResponse (com.facebook.buck.distributed.thrift.MultiGetBuildSlaveRealTimeLogsResponse)1 StartBuildRequest (com.facebook.buck.distributed.thrift.StartBuildRequest)1 StartBuildResponse (com.facebook.buck.distributed.thrift.StartBuildResponse)1 Console (com.facebook.buck.util.Console)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Stopwatch (com.google.common.base.Stopwatch)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1