Skip to content

Commit e827f55

Browse files
committed
use subfolder to avoid confusion with file list yaml
1 parent bf85044 commit e827f55

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

src/main/groovy/com/github/hauner/openapi/test/ProcessorTestBase.groovy

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ abstract class ProcessorTestBase {
4848
def processor = testSet.processor
4949
def options = [
5050
parser: testSet.parser,
51-
apiPath: "resource:/tests/${source}/openapi.yaml",
51+
apiPath: "resource:/tests/${source}/inputs/openapi.yaml",
5252
targetDir: folder.root
5353
]
5454

55-
def mappingYaml = getResource ("/tests/${source}/mapping.yaml")
55+
def mappingYaml = getResource ("/tests/${source}/inputs/mapping.yaml")
5656
if(mappingYaml) {
5757
options.mapping = mappingYaml.text
5858
} else {
@@ -93,10 +93,11 @@ abstract class ProcessorTestBase {
9393

9494
Path root = Files.createDirectory (fs.getPath ("source"))
9595

96-
copy ("/tests/${source}", collectAbsoluteInputPaths ("/tests/${source}"), root)
97-
copy ("/tests/${source}", collectAbsoluteOutputPaths ("/tests/${source}"), root)
96+
def path = "/tests/${source}"
97+
copy (path, collectAbsoluteInputPaths (path), root)
98+
copy (path, collectAbsoluteOutputPaths (path), root)
9899

99-
Path api = root.resolve ('openapi.yaml')
100+
Path api = root.resolve ('inputs/openapi.yaml')
100101
Path target = fs.getPath ('target')
101102

102103
def processor = testSet.processor
@@ -106,7 +107,7 @@ abstract class ProcessorTestBase {
106107
targetDir: target.toUri ().toURL ().toString ()
107108
]
108109

109-
def mappingYaml = root.resolve ('mapping.yaml')
110+
def mappingYaml = root.resolve ('inputs/mapping.yaml')
110111
if(Files.exists (mappingYaml)) {
111112
options.mapping = mappingYaml.toUri ().toURL ().toString ()
112113
} else {
@@ -204,14 +205,14 @@ abstract class ProcessorTestBase {
204205
* collect output paths
205206
*/
206207
protected List<String> collectAbsoluteOutputPaths (String path) {
207-
collectAbsoluteResourcePaths (path, "outputs.yaml")
208+
collectAbsoluteResourcePaths (path, "generated.yaml")
208209
}
209210

210211
/**
211212
* collect output paths, relative to packageName
212213
*/
213214
protected List<String> collectRelativeOutputPaths (String path, String packageName) {
214-
collectRelativeResourcePaths (path, "outputs.yaml").collect {
215+
collectRelativeResourcePaths (path, "generated.yaml").collect {
215216
it.substring (packageName.size () + 1)
216217
}
217218
}
@@ -229,9 +230,13 @@ abstract class ProcessorTestBase {
229230
* collect paths from output.yaml in resources
230231
*/
231232
protected List<String> collectRelativeResourcePaths (String path, String itemsYaml) {
232-
def source = getResource ("${path}/${itemsYaml}").text
233+
def source = getResource ("${path}/${itemsYaml}")
234+
if (!source) {
235+
println "ERROR: missing '${path}/${itemsYaml}' configuration file!"
236+
}
237+
233238
def mapper = createYamlParser ()
234-
def sourceItems = mapper.readValue (source, TestItems)
239+
def sourceItems = mapper.readValue (source.text, TestItems)
235240
sourceItems.items
236241
}
237242

0 commit comments

Comments
 (0)