Skip to content

Commit

Permalink
issue #1: demo tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dxoakes committed Oct 27, 2017
1 parent fa7ba6f commit 43237e8
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry excluding="Archive/" kind="src" output="build/assets" path="assets"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="GROOVY_SUPPORT">
<attributes>
<attribute name="minimal" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
Expand Down
5 changes: 5 additions & 0 deletions assets/com/centurylink/mdw/demo/test/.mdw/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "com.centurylink.mdw.demo.test",
"schemaVersion": "6.0",
"version": "0.0.06"
}
6 changes: 6 additions & 0 deletions assets/com/centurylink/mdw/demo/test/.mdw/versions
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions assets/com/centurylink/mdw/demo/test/BugWorkflow.test
Original file line number Diff line number Diff line change
@@ -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')
54 changes: 54 additions & 0 deletions assets/com/centurylink/mdw/demo/test/BugWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -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"
}
8 changes: 8 additions & 0 deletions assets/com/centurylink/mdw/demo/test/createBugRequest.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
3 changes: 3 additions & 0 deletions assets/com/centurylink/mdw/demo/test/localhost.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"base-url": "http://localhost:8080/mdw/services"
}
82 changes: 82 additions & 0 deletions assets/com/centurylink/mdw/demo/test/mdw-demo.postman
Original file line number Diff line number Diff line change
@@ -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": []
}
]
}

0 comments on commit 43237e8

Please sign in to comment.