use of com.netflix.conductor.contribs.http.HttpTask.Input in project conductor by Netflix.
the class TestHttpTask method testOAuth.
@Test
public void testOAuth() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/oauth");
input.setMethod("POST");
input.setOauthConsumerKey("someKey");
input.setOauthConsumerSecret("someSecret");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
httpTask.start(workflow, task, workflowExecutor);
Map<String, Object> response = (Map<String, Object>) task.getOutputData().get("response");
Map<String, String> body = (Map<String, String>) response.get("body");
assertEquals("someKey", body.get("oauth_consumer_key"));
assertTrue("Should have OAuth nonce", body.containsKey("oauth_nonce"));
assertTrue("Should have OAuth signature", body.containsKey("oauth_signature"));
assertTrue("Should have OAuth signature method", body.containsKey("oauth_signature_method"));
assertTrue("Should have OAuth oauth_timestamp", body.containsKey("oauth_timestamp"));
assertTrue("Should have OAuth oauth_version", body.containsKey("oauth_version"));
assertEquals("Task output: " + task.getOutputData(), Status.COMPLETED, task.getStatus());
}
use of com.netflix.conductor.contribs.http.HttpTask.Input in project conductor by Netflix.
the class TestHttpTask method testPostNoContent.
@Test
public void testPostNoContent() {
Task task = new Task();
Input input = new Input();
input.setUri("http://localhost:7009/post2");
Map<String, Object> body = new HashMap<>();
body.put("input_key1", "value1");
body.put("input_key2", 45.3d);
input.setBody(body);
input.setMethod("POST");
task.getInputData().put(HttpTask.REQUEST_PARAMETER_NAME, input);
httpTask.start(workflow, task, workflowExecutor);
assertEquals(task.getReasonForIncompletion(), Task.Status.COMPLETED, task.getStatus());
Map<String, Object> hr = (Map<String, Object>) task.getOutputData().get("response");
Object response = hr.get("body");
assertEquals(Task.Status.COMPLETED, task.getStatus());
assertNull("response is: " + response, response);
}
Aggregations