-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
492 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...ing.dsl/src/main/java/app/hypermedia/testing/dsl/conversion/MultilineBlockConverter.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package app.hypermedia.testing.dsl.conversion | ||
|
||
import org.eclipse.xtext.conversion.IValueConverter | ||
import org.eclipse.xtext.conversion.ValueConverterException | ||
import org.eclipse.xtext.nodemodel.INode | ||
|
||
class MultilineBlockConverter implements IValueConverter<String> { | ||
final String INVALID_VALUE_ERROR = "Code block must be between triple backticks" | ||
|
||
override toString(String value) { | ||
return value | ||
} | ||
|
||
override toValue(String string, INode node) throws ValueConverterException { | ||
if (string === null) { | ||
return null | ||
} | ||
|
||
if(string.length < 7 || !string.startsWith("```") || !string.endsWith("```")) { | ||
throw new ValueConverterException(INVALID_VALUE_ERROR, node, null) | ||
} | ||
|
||
return string.substring(3, string.length - 3).trim() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 174 additions & 0 deletions
174
...esting.dsl/src/test/java/app/hypermedia/testing/dsl/tests/generator/hydra/InvokeTest.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
app.hypermedia.testing.dsl.tests.generator.hydra.InvokeTest.classOperation_invokeTwiceWithRequests_generatesSteps=[ | ||
{ | ||
"map": { | ||
"steps": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"children": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"children": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"body": { | ||
"map": { | ||
"path": "/some/path/data.csv" | ||
}, | ||
"empty": false | ||
}, | ||
"children": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"code": 201, | ||
"type": "ResponseStatus" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
}, | ||
"headers": { | ||
"map": { | ||
"Content-Type": "text/csv" | ||
}, | ||
"empty": false | ||
}, | ||
"type": "Invocation" | ||
}, | ||
"empty": false | ||
}, | ||
{ | ||
"map": { | ||
"body": "{\n \"hello\": \"world\",\n \"foo\": \"bar\"\n }", | ||
"children": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"code": 409, | ||
"type": "ResponseStatus" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
}, | ||
"headers": { | ||
"map": { | ||
"Content-Type": "application/json" | ||
}, | ||
"empty": false | ||
}, | ||
"type": "Invocation" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
}, | ||
"operationId": "http://example.com/CreateUser", | ||
"strict": false, | ||
"type": "Operation" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
}, | ||
"classId": "http://example.com/People", | ||
"type": "Class" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
} | ||
}, | ||
"empty": false | ||
} | ||
] | ||
|
||
|
||
app.hypermedia.testing.dsl.tests.generator.hydra.InvokeTest.topLevelOperation_invokeTwiceWithRequests_generatesSteps=[ | ||
{ | ||
"map": { | ||
"steps": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"children": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"body": { | ||
"map": { | ||
"path": "/some/path/data.csv" | ||
}, | ||
"empty": false | ||
}, | ||
"children": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"code": 201, | ||
"type": "ResponseStatus" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
}, | ||
"headers": { | ||
"map": { | ||
"Content-Type": "text/csv" | ||
}, | ||
"empty": false | ||
}, | ||
"type": "Invocation" | ||
}, | ||
"empty": false | ||
}, | ||
{ | ||
"map": { | ||
"body": "{\n \"hello\": \"world\",\n \"foo\": \"bar\"\n }", | ||
"children": { | ||
"myArrayList": [ | ||
{ | ||
"map": { | ||
"code": 409, | ||
"type": "ResponseStatus" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
}, | ||
"headers": { | ||
"map": { | ||
"Content-Type": "application/json" | ||
}, | ||
"empty": false | ||
}, | ||
"type": "Invocation" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
}, | ||
"operationId": "http://example.com/CreateUser", | ||
"strict": false, | ||
"type": "Operation" | ||
}, | ||
"empty": false | ||
} | ||
], | ||
"empty": false | ||
} | ||
}, | ||
"empty": false | ||
} | ||
] |
Oops, something went wrong.