# Can be executed with HTTP client built-in plugin in IDEA
################ RBAC CHECK ################
### Check if user has network-operator privileges GET http://localhost:8088/proxy/editableworkflows x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.body === true, response.body);
}); %}
### Check if user has network-operator privileges GET http://localhost:8088/proxy/editableworkflows x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.body === false, response.body);
}); %}
################ RBAC CHECK END ################
################ WORKFLOW METADATA ################
## Add new WF def
### Add new workflow def as admin via proxy accessible only to admins PUT http://localhost:8088/proxy/api/metadata/workflow Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- [
- {
"name": "fx1", "description": "accessible to admins only", "ownerEmail": "[email protected]", "version": 1, "schemaVersion": 2, "tasks": [
- {
"name": "bar", "taskReferenceName": "barref", "type": "TERMINATE", "inputParameters": {
"terminationStatus": "FAILED"
}
}
]
}
]
> {% client.test("test", function() {
client.assert(response.status === 204);
}); %}
### Add new workflow def as admin via proxy accessible to also operators and testers PUT http://localhost:8088/proxy/api/metadata/workflow Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- [
- {
"name": "fx3", "description": "accessible to operators and testers - OPERATOR,TEST", "ownerEmail": "[email protected]", "version": 1, "schemaVersion": 2, "tasks": [
- {
"name": "bar", "taskReferenceName": "barref", "type": "TERMINATE", "inputParameters": {
"terminationStatus": "FAILED"
}
}
]
}
]
> {% client.test("test", function() {
client.assert(response.status === 204);
}); %}
### Get all workflows
### Get all workflow defs as admin via proxy GET http://localhost:8088/proxy/api/metadata/workflow x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).length === 2, response.body);
}); %}
### Get all workflow defs as operator via rbac_proxy GET http://localhost:8088/proxy/api/metadata/workflow x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).length === 1, response.body);
}); %}
### Get a single workflow def
### Get a single workflow def as admin via proxy GET http://localhost:8088/proxy/api/metadata/workflow/fx3 x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).name === "fx3", response.body);
}); %}
### Get a single workflow def as operator via proxy GET http://localhost:8088/proxy/api/metadata/workflow/fx3 x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).name === "fx3", response.body);
}); %}
### Get a single workflow def as operator via proxy: FAIL 401 GET http://localhost:8088/proxy/api/metadata/workflow/fx1 x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
################ WORKFLOW METADATA END ################
################ WORKFLOW EXEC ################
## Execute WF
### Execute workflow as an admin via proxy POST http://localhost:8088/proxy/api/workflow Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- {
- "name": "fx1"
}
> {% client.test("test", function() {
client.assert(response.status === 200, response.body);
}); client.global.set("admin_exec_1", response.body); %}
### Execute workflow as an admin via rbac proxy POST http://localhost:8088/proxy/api/workflow Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- {
- "name": "fx3"
}
> {% client.test("test", function() {
client.assert(response.status === 200, response.body);
}); client.global.set("admin_exec_2", response.body); %}
### Execute workflow as operator via rbac_proxy: FAIL 401 (workflow not accessible for operators) POST http://localhost:8088/proxy/api/workflow Content-Type: application/json x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
- {
- "name": "fx1"
}
> {% client.test("test", function() {
client.assert(response.status === 401, response.body);
}); %}
### Execute workflow as operator via rbac_proxy # SUCCESS POST http://localhost:8088/proxy/api/workflow Content-Type: application/json x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
- {
- "name": "fx3", "version": 1
}
> {% client.test("test", function() {
client.assert(response.status === 200, response.body);
}); client.global.set("oper_exec_1", response.body); // Sleep a little to make sure this wf finishes before moving to next request // This is running in nashorn so we can use JVM sleep java.lang.Thread.sleep(2000) %}
### Search WF executions
### Get all workflow executions as admin via proxy GET http://localhost:8088/proxy/api/workflow/search x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 3, response.body);
}); %}
### Get all workflow executions as operator via proxy GET http://localhost:8088/proxy/api/workflow/search x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 1, response.body);
}); %}
## Get a single workflow execution
### Get a single workflow execution as admin via proxy GET http://localhost:8088/proxy/api/workflow/{{admin_exec_1}}?includeTasks=true x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).workflowName === "fx1", response.body);
}); %}
### Get a single workflow execution as admin via rbac_proxy GET http://localhost:8088/proxy/api/workflow/{{admin_exec_2}}?includeTasks=true x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).workflowName === "fx3", response.body);
}); %}
### Get a single workflow execution as operator via proxy: FAIL 401 GET http://localhost:8088/proxy/api/workflow/{{oper_exec_1}}?includeTasks=true x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
### Get a single workflow execution as operator via rbac_proxy: OK correlation ID matches GET http://localhost:8088/proxy/api/workflow/{{oper_exec_1}}?includeTasks=true x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response.status); client.assert(JSON.parse(response.body).workflowName === "fx3", response.body);
}); %}
### Get a single workflow execution as operator via rbac_proxy: FAIL 401 correlation ID doesn't match GET http://localhost:8088/proxy/api/workflow/{{admin_exec_1}}?includeTasks=true x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
## Search for workflow executions
### Get filtered workflow executions as admin via proxy (COMPLETED) GET http://localhost:8088/proxy/api/workflow/search?query=status+IN+(COMPLETED) x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 0, response.body);
}); %}
### Get filtered workflow executions as admin via proxy (executed by fb-operator) GET http://localhost:8088/proxy/api/workflow/search?query=correlationId+IN+(fb-operator) x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 1, response.body);
}); %}
### Get all workflow executions as admin via proxy GET http://localhost:8088/proxy/api/workflow/search x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 3, response.body);
}); %}
### Get all workflow executions as admin via rbac proxy GET http://localhost:8088/proxy/api/workflow/search x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 2, response.body);
}); %}
### Get all workflow executions as operator via rbac proxy GET http://localhost:8088/proxy/api/workflow/search x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 200, response); client.assert(JSON.parse(response.body).totalHits === 1, response.body);
}); %}
## Delete workflow executions
### Delete workflow execution as operator via rbac-proxy: FAIL 401 wrong correlation ID DELETE http://localhost:8088/proxy/api/workflow/{{admin_exec_1}}/remove x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 401, response);
}); %}
### Delete workflow execution as operator via rbac-proxy DELETE http://localhost:8088/proxy/api/workflow/{{oper_exec_1}}/remove x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
### Delete workflow execution as admin via proxy DELETE http://localhost:8088/proxy/api/workflow/{{admin_exec_1}}/remove x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
### Delete workflow execution as admin via proxy DELETE http://localhost:8088/proxy/api/workflow/{{admin_exec_2}}/remove x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
################ WORKFLOW END ################
################ WORKFLOW METADATA DELETION ################
## Delete a single workflow def
### Delete workflow def as operator via rbac_proxy: FAIL 401 DELETE http://localhost:8088/proxy/api/metadata/workflow/fx1/1 x-tenant-id: frinx from: fb-operator x-auth-user-groups: OPERATOR
> {% client.test("test", function() {
client.assert(response.status === 404, response);
}); %}
### Delete workflow def as admin via proxy DELETE http://localhost:8088/proxy/api/metadata/workflow/fx1/1 x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
### Delete workflow def as admin via proxy DELETE http://localhost:8088/proxy/api/metadata/workflow/fx3/1 x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
> {% client.test("test", function() {
client.assert(response.status === 204, response);
}); %}
################ WORKFLOW METADATA DELETION END ################
################ TASKS ################
### Register test task POST http://localhost:8088/proxy/api/metadata/taskdefs Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- [{
- "name": "test_task", "retryCount": 0, "timeoutSeconds": 1200, "pollTimeoutSeconds": 3600, "timeoutPolicy": "TIME_OUT_WF", "retryLogic": "FIXED", "retryDelaySeconds": 600, "responseTimeoutSeconds": 1200, "concurrentExecLimit": 100, "rateLimitFrequencyInSeconds": 60, "rateLimitPerFrequency": 50
}]
### Update task def (just to verify the PUT endpoint) PUT http://localhost:8088/proxy/api/metadata/taskdefs Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- {
- "name": "test_task", "retryCount": 0, "timeoutSeconds": 1200, "pollTimeoutSeconds": 3200, "timeoutPolicy": "TIME_OUT_WF", "retryLogic": "FIXED", "retryDelaySeconds": 600, "responseTimeoutSeconds": 1200, "concurrentExecLimit": 100, "rateLimitFrequencyInSeconds": 60, "rateLimitPerFrequency": 50
}
### Get test task GET http://localhost:8088/proxy/api/metadata/taskdefs/test_task Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
### Get all tasks GET http://localhost:8088/proxy/api/metadata/taskdefs Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
### Register workflow with test task PUT http://localhost:8088/proxy/api/metadata/workflow Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- [
- {
"name": "test_wf1", "ownerEmail": "[email protected]", "version": 1, "schemaVersion": 2, "tasks": [
- {
- "name": "test_task", "taskReferenceName": "test", "type": "SIMPLE"
}
]
}
]
### Execute workflow with test task POST http://localhost:8088/proxy/api/workflow Content-Type: application/json x-tenant-id: frinx from: fb-user x-auth-user-groups: network-admin
- {
- "name": "test_wf1"
}
### Get task queues GET http://localhost:8088/proxy/api/tasks/queue/all x-tenant-id: frinx from: fb-operator x-auth-user-groups: network-admin
### Get tasks in batch GET http://localhost:8088/proxy/api/tasks/poll/batch/test_task?workerid=test&count=10 x-tenant-id: frinx from: fb-operator x-auth-user-groups: network-admin
### Get task GET http://localhost:8088/proxy/api/tasks/poll/test_task x-tenant-id: frinx from: fb-operator x-auth-user-groups: network-admin
### ACK task POST http://localhost:8088/proxy/api/tasks/671cedd8-61c2-4880-8fba-d02bc75c25d9/ack x-tenant-id: frinx from: fb-operator x-auth-user-groups: network-admin
### Complete task POST http://localhost:8088/proxy/api/tasks Content-Type: application/json x-tenant-id: frinx from: fb-operator x-auth-user-groups: network-admin
- {
- "workflowInstanceId": "647c7e76-5b12-4368-86e2-0e24037c6474", "taskId": "9cba9d77-8763-47f2-bc62-0f9869417fbe", "status": "COMPLETED"
}
################ TASKS END ################