本文整理了Java中com.netflix.conductor.common.metadata.tasks.Task.<init>()
方法的一些代码示例,展示了Task.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.<init>()
方法的具体详情如下:
包路径:com.netflix.conductor.common.metadata.tasks.Task
类名称:Task
方法名:<init>
暂无
代码示例来源:origin: Netflix/conductor
@Test
public void testJsonSerializing() throws Exception {
ObjectMapper om = new ObjectMapper();
Task task = new Task();
TaskSummary taskSummary = new TaskSummary(task);
String json = om.writeValueAsString(taskSummary);
TaskSummary read = om.readValue(json, TaskSummary.class);
assertNotNull(read);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testView() throws Exception {
Task task = new Task();
task.setReferenceTaskName("test");
List<Task> listOfTask = new ArrayList<>();
listOfTask.add(task);
when(mockAdminService.getListOfPendingTask(anyString(), anyInt(), anyInt())).thenReturn(listOfTask);
assertEquals(listOfTask, adminResource.view("testTask", 0, 100));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testBatchPoll() throws Exception{
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
List<Task> listOfTasks = new ArrayList<>();
listOfTasks.add(task);
when(mockTaskService.batchPoll(anyString(), anyString(), anyString(), anyInt(), anyInt())).thenReturn(listOfTasks);
assertEquals(listOfTasks, taskResource.batchPoll("SIMPLE", "123",
"test", 1, 100));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testGetInProgressTasks() throws Exception {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
task.setStatus(Task.Status.IN_PROGRESS);
List<Task> listOfTasks = new ArrayList<>();
listOfTasks.add(task);
when(mockTaskService.getTasks(anyString(), anyString(), anyInt())).thenReturn(listOfTasks);
assertEquals(listOfTasks, taskResource.getTasks("SIMPLE", "123", 123));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testPoll() throws Exception {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
when(mockTaskService.poll(anyString(), anyString(), anyString())).thenReturn(task);
assertEquals(task, taskResource.poll("SIMPLE", "123", "test"));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testExceedsRateLimitWhenNoRateLimitSet() {
Task task =new Task();
assertFalse(executionDAO.exceedsRateLimitPerFrequency(task));
}
@Test
代码示例来源:origin: Netflix/conductor
@Test
public void testGetPendingTaskForWorkflow() {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
task.setStatus(Task.Status.IN_PROGRESS);
when(mockTaskService.getPendingTaskForWorkflow(anyString(), anyString())).thenReturn(task);
assertEquals(task, taskResource.getPendingTaskForWorkflow("SIMPLE", "123"));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testCreateTaskException2() {
Task task = new Task();
task.setScheduledTime(1L);
task.setSeq(1);
task.setTaskId(UUID.randomUUID().toString());
task.setTaskDefName("task1");
task.setWorkflowInstanceId(UUID.randomUUID().toString());
expectedException.expect(ApplicationException.class);
expectedException.expectMessage("Task reference name cannot be null");
getExecutionDAO().createTasks(Collections.singletonList(task));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testGetTask() throws Exception {
Task task = new Task();
task.setTaskType("SIMPLE");
task.setWorkerId("123");
task.setDomain("test");
task.setStatus(Task.Status.IN_PROGRESS);
when(mockTaskService.getTask(anyString())).thenReturn(task);
assertEquals(task, taskResource.getTask("123"));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testTextGET() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/text");
input.setMethod("GET");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
httpTask.start(workflow, task, workflowExecutor);
Map<String, Object> hr = (Map<String, Object>) task.getOutputData().get("response");
Object response = hr.get("body");
assertEquals(Task.Status.COMPLETED, task.getStatus());
assertEquals(TEXT_RESPONSE, response);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testFailTaskWithOutputPayload() {
Task task = new Task();
task.setOutputData(new HashMap<>());
expectedException.expect(TerminateWorkflowException.class);
externalPayloadStorageUtils.failTask(task, ExternalPayloadStorage.PayloadType.TASK_OUTPUT, "error");
assertNotNull(task);
assertNull(task.getOutputData());
}
}
代码示例来源:origin: Netflix/conductor
@Test
public void testJsonGET() throws JsonProcessingException {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/json");
input.setMethod("GET");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
httpTask.start(workflow, task, workflowExecutor);
Map<String, Object> hr = (Map<String, Object>) task.getOutputData().get("response");
Object response = hr.get("body");
assertEquals(Task.Status.COMPLETED, task.getStatus());
assertTrue(response instanceof Map);
Map<String, Object> map = (Map<String, Object>) response;
assertEquals(JSON_RESPONSE, objectMapper.writeValueAsString(map));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testFailTaskWithInputPayload() {
Task task = new Task();
task.setInputData(new HashMap<>());
expectedException.expect(TerminateWorkflowException.class);
externalPayloadStorageUtils.failTask(task, ExternalPayloadStorage.PayloadType.TASK_INPUT, "error");
assertNotNull(task);
assertNull(task.getInputData());
}
代码示例来源:origin: Netflix/conductor
@Test
public void testExceedsRateLimitWithinLimit() {
Task task =new Task();
task.setRateLimitFrequencyInSeconds(60);
task.setRateLimitPerFrequency(20);
assertFalse(executionDAO.exceedsRateLimitPerFrequency(task));
}
@Test
代码示例来源:origin: Netflix/conductor
@Test
public void testNumberGET() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/numeric");
input.setMethod("GET");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
httpTask.start(workflow, task, workflowExecutor);
Map<String, Object> hr = (Map<String, Object>) task.getOutputData().get("response");
Object response = hr.get("body");
assertEquals(Task.Status.COMPLETED, task.getStatus());
assertEquals(NUM_RESPONSE, response);
assertTrue(response instanceof Number);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testExecute() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/json");
input.setMethod("GET");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
task.setStatus(Status.SCHEDULED);
task.setScheduledTime(0);
boolean executed = httpTask.execute(workflow, task, workflowExecutor);
assertFalse(executed);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testIsResponsedTimeOut() {
TaskDef taskDef = new TaskDef();
taskDef.setName("test_rt");
taskDef.setResponseTimeoutSeconds(10);
Task task = new Task();
task.setTaskDefName("test_rt");
task.setStatus(Status.IN_PROGRESS);
task.setTaskId("aa");
task.setUpdateTime(System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(11));
boolean flag = deciderService.isResponseTimedOut(taskDef, task);
assertNotNull(task);
assertTrue(flag);
}
代码示例来源:origin: Netflix/conductor
@Test
public void testExceedsRateLimitOutOfLimit() {
Task task =new Task();
task.setRateLimitFrequencyInSeconds(60);
task.setRateLimitPerFrequency(1);
assertFalse(executionDAO.exceedsRateLimitPerFrequency(task));
assertTrue(executionDAO.exceedsRateLimitPerFrequency(task));
}
代码示例来源:origin: Netflix/conductor
@Test
public void testTaskDefinitionIfAvailable() {
Task task = new Task();
task.setStatus(Status.FAILED);
assertEquals(Status.FAILED, task.getStatus());
assertNull(task.getWorkflowTask());
assertFalse(task.getTaskDefinition().isPresent());
WorkflowTask workflowTask = new WorkflowTask();
TaskDef taskDefinition = new TaskDef();
workflowTask.setTaskDefinition(taskDefinition);
task.setWorkflowTask(workflowTask);
assertTrue(task.getTaskDefinition().isPresent());
assertEquals(taskDefinition, task.getTaskDefinition().get());
}
}
代码示例来源:origin: Netflix/conductor
@Test
public void testFailure() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/failure");
input.setMethod("GET");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
httpTask.start(workflow, task, workflowExecutor);
assertEquals("Task output: " + task.getOutputData(), Task.Status.FAILED, task.getStatus());
assertEquals(ERROR_RESPONSE, task.getReasonForIncompletion());
task.setStatus(Status.SCHEDULED);
task.getInputData().remove(HttpTask.REQUEST_PARAMETER_NAME);
httpTask.start(workflow, task, workflowExecutor);
assertEquals(Task.Status.FAILED, task.getStatus());
assertEquals(HttpTask.MISSING_REQUEST, task.getReasonForIncompletion());
}
内容来源于网络,如有侵权,请联系作者删除!