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;
}
Aggregations