use of com.netflix.conductor.contribs.http.HttpTask.Input in project conductor by Netflix.
the class TestHttpTask method testHTTPGetConnectionTimeOut.
@Test
public void testHTTPGetConnectionTimeOut() throws Exception {
Task task = new Task();
Input input = new Input();
Instant start = Instant.now();
input.setConnectionTimeOut(110);
input.setMethod("GET");
input.setUri("http://10.255.14.15");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
task.setStatus(Status.SCHEDULED);
task.setScheduledTime(0);
httpTask.start(workflow, task, workflowExecutor);
Instant end = Instant.now();
long diff = end.toEpochMilli() - start.toEpochMilli();
Assert.assertEquals(task.getStatus(), Status.FAILED);
Assert.assertTrue(diff >= 110l);
}
use of com.netflix.conductor.contribs.http.HttpTask.Input in project conductor by Netflix.
the class TestHttpTask method testHTTPGETReadTimeOut.
@Test
public void testHTTPGETReadTimeOut() throws Exception {
Task task = new Task();
Input input = new Input();
input.setReadTimeOut(-1);
input.setMethod("GET");
input.setUri("http://localhost:7009/json");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
task.setStatus(Status.SCHEDULED);
task.setScheduledTime(0);
httpTask.start(workflow, task, workflowExecutor);
Assert.assertEquals(task.getStatus(), Status.FAILED);
}
use of com.netflix.conductor.contribs.http.HttpTask.Input in project conductor by Netflix.
the class TestHttpTask method testTextGET.
@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);
}
use of com.netflix.conductor.contribs.http.HttpTask.Input in project conductor by Netflix.
the class TestHttpTask method testExecute.
@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);
}
use of com.netflix.conductor.contribs.http.HttpTask.Input in project conductor by Netflix.
the class TestHttpTask method testFailure.
@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());
}
Aggregations