diff --git a/.classpath b/.classpath index 97a2aa90..6623add7 100644 --- a/.classpath +++ b/.classpath @@ -3,16 +3,12 @@ - - - - - + diff --git a/.project b/.project index 63f64fac..7e11e037 100644 --- a/.project +++ b/.project @@ -27,6 +27,7 @@ + org.eclipse.jdt.groovy.core.groovyNature org.eclipse.jdt.core.javanature org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.common.modulecore.ModuleCoreNature diff --git a/assets/com/centurylink/mdw/demo/test/.mdw/package.json b/assets/com/centurylink/mdw/demo/test/.mdw/package.json new file mode 100644 index 00000000..001392f1 --- /dev/null +++ b/assets/com/centurylink/mdw/demo/test/.mdw/package.json @@ -0,0 +1,5 @@ +{ + "name": "com.centurylink.mdw.demo.test", + "schemaVersion": "6.0", + "version": "0.0.06" +} \ No newline at end of file diff --git a/assets/com/centurylink/mdw/demo/test/.mdw/versions b/assets/com/centurylink/mdw/demo/test/.mdw/versions new file mode 100644 index 00000000..9cc3be62 --- /dev/null +++ b/assets/com/centurylink/mdw/demo/test/.mdw/versions @@ -0,0 +1,6 @@ +BugWorkflow.test=1 +BugWorkflow.yaml=1 +createBugRequest.json=1 +localhost.env=1 Renamed from e:\workspaces\dons\mdw-demo\assets\com\centurylink\mdw\demo\test\localhost.values +localhost.values=1 +mdw-demo.postman=1 diff --git a/assets/com/centurylink/mdw/demo/test/BugWorkflow.test b/assets/com/centurylink/mdw/demo/test/BugWorkflow.test new file mode 100644 index 00000000..3186d742 --- /dev/null +++ b/assets/com/centurylink/mdw/demo/test/BugWorkflow.test @@ -0,0 +1,36 @@ +// directly test Create Bug and A Bug's Life +start process('com.centurylink.mdw.demo.bugs/Create Bug') { + variables = [ + request: asset('createBugRequest.json').text, + requestHeaders: """{\"content-type\": \"application/json\", + \"mdw-request-id\": \"$masterRequestId\"}""" + ] +} + +sleep 5 + +def bugTask = action task('${bug.title}') { + outcome = 'Claim' +} + +sleep 5 + +// submit a PUT request emulating commitId entry in custom page +def response = submit request('mdw-demo.postman/PUT:bugs/{id}') { + values = ['id': bugTask.id, 'commit-id': 'fa7ba6f'] +} +assert response.time < 1000 // less than a second +assert response.status.code == 200 +assert response.headers['content-type'] == 'application/json' + +// resolve the bug by completing its task +action task('${bug.title}') { + outcome = 'Resolve' +} + +// wait for the subflow to complete +wait process('com.centurylink.mdw.demo.bugs/A Bug\'s Life') + +// validate the runtime results of both processes +verify processes('com.centurylink.mdw.demo.bugs/Create Bug', + 'com.centurylink.mdw.demo.bugs/A Bug\'s Life') \ No newline at end of file diff --git a/assets/com/centurylink/mdw/demo/test/BugWorkflow.yaml b/assets/com/centurylink/mdw/demo/test/BugWorkflow.yaml new file mode 100644 index 00000000..9de8894f --- /dev/null +++ b/assets/com/centurylink/mdw/demo/test/BugWorkflow.yaml @@ -0,0 +1,54 @@ +process: # 10009 + name: Create Bug + instance: 1 + activity: # 1 "2017-10-27 11:03:30" + name: Start + status: Completed + activity: # 3 "2017-10-27 11:03:30" + name: | + Validate + Request + status: Completed + result: accepted + activity: # 5 "2017-10-27 11:03:30" + name: Save Bug + status: Completed + activity: # 6 "2017-10-27 11:03:30" + name: | + Invoke Bug + Workflow + status: Completed + activity: # 2 "2017-10-27 11:03:30" + name: Created + status: Completed + variable: # 10021 + name: request + value: | + { + "description": "This is a sev 1 showstopper", + "severity": 1, + "title": "Don's car needs washing" + } + variable: # 10022 + name: requestHeaders + value: | + { + "content-type": "application/json", + "mdw-request-id": "dxoakes-171027-110326738" + } + variable: # 10023 + name: response + value: | + { + "description": "This is a sev 1 showstopper", + "id": 10003, + "severity": 1, + "title": "Don's car needs washing" + } + variable: # 10024 + name: responseHeaders + value: | + { + "HttpStatusCode": "201", + "Location": "http://localhost:8080/mdw/demo/api/bugs/10003" + } \ No newline at end of file diff --git a/assets/com/centurylink/mdw/demo/test/createBugRequest.json b/assets/com/centurylink/mdw/demo/test/createBugRequest.json new file mode 100644 index 00000000..cc9b571f --- /dev/null +++ b/assets/com/centurylink/mdw/demo/test/createBugRequest.json @@ -0,0 +1,8 @@ +{ + "_type": "com.centurylink.mdw.demo.bugs.Bug", + "bug": { + "title": "Don's car needs washing", + "severity": 1, + "description": "This is a sev 1 showstopper" + } +} \ No newline at end of file diff --git a/assets/com/centurylink/mdw/demo/test/localhost.env b/assets/com/centurylink/mdw/demo/test/localhost.env new file mode 100644 index 00000000..fd5d878f --- /dev/null +++ b/assets/com/centurylink/mdw/demo/test/localhost.env @@ -0,0 +1,3 @@ +{ + "base-url": "http://localhost:8080/mdw/services" +} \ No newline at end of file diff --git a/assets/com/centurylink/mdw/demo/test/mdw-demo.postman b/assets/com/centurylink/mdw/demo/test/mdw-demo.postman new file mode 100644 index 00000000..c1a507d7 --- /dev/null +++ b/assets/com/centurylink/mdw/demo/test/mdw-demo.postman @@ -0,0 +1,82 @@ +{ + "variables": [], + "info": { + "name": "mdw-demo", + "_postman_id": "14050b74-5b83-34a6-06ac-710716e67e94", + "description": "", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" + }, + "item": [ + { + "name": "bugs", + "request": { + "url": "{{base-url}}/demo/api/bugs", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"title\": \"Missing documentation on package-level handlers\",\r\n \"description\": \"Someone needs to step up. I'm not saying who...\",\r\n \"severity\": 2\r\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "bugs/{id}", + "request": { + "url": "{{base-url}}/demo/api/bugs/{{id}}", + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"title\": \"Missing documentation on package-level handlers\",\n \"description\": \"Someone needs to step up. I'm not saying who...\",\n \"severity\": 2,\n \"commitId\": {{commit-id}}\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "bugs/{id}", + "request": { + "url": "{{base-url}}/demo/api/bugs/{{id}}", + "method": "GET", + "header": [], + "body": {}, + "description": "" + }, + "response": [] + }, + { + "name": "rules", + "request": { + "url": "{{base-url}}/Rules/demo.api/Playlist", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"name\": \"Don Oakes\",\r\n \"yearOfBirth\": 1962,\r\n \"genre\": \"punk\"\r\n}" + }, + "description": "" + }, + "response": [] + } + ] +} \ No newline at end of file