Search in sources :

Example 1 with TaskRequest

use of com.netflix.fenzo.TaskRequest in project elastic-job by dangdangdotcom.

the class TaskLaunchScheduledServiceTest method mockTaskAssignmentResult.

private TaskAssignmentResult mockTaskAssignmentResult(final String taskName, final ExecutionType executionType) {
    TaskAssignmentResult result = mock(TaskAssignmentResult.class);
    TaskRequest taskRequest = new JobTaskRequest(new TaskContext(taskName, Lists.newArrayList(0), executionType, "unassigned-slave"), CloudJobConfigurationBuilder.createCloudJobConfiguration(taskName));
    when(result.getTaskId()).thenReturn(String.format("%s@-@0@-@%s@-@unassigned-slave@-@0", taskName, executionType.name()));
    when(result.getHostname()).thenReturn("localhost");
    when(result.getAssignedPorts()).thenReturn(Lists.newArrayList(1234));
    when(result.getRequest()).thenReturn(taskRequest);
    when(result.isSuccessful()).thenReturn(true);
    when(result.getFitness()).thenReturn(1.0);
    return result;
}
Also used : TaskContext(com.dangdang.ddframe.job.context.TaskContext) TaskAssignmentResult(com.netflix.fenzo.TaskAssignmentResult) TaskRequest(com.netflix.fenzo.TaskRequest)

Aggregations

TaskContext (com.dangdang.ddframe.job.context.TaskContext)1 TaskAssignmentResult (com.netflix.fenzo.TaskAssignmentResult)1 TaskRequest (com.netflix.fenzo.TaskRequest)1