All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.openapiprocessor.test.TestItems.groovy Maven / Gradle / Ivy

There is a newer version: 2024.6.1
Show newest version
/*
 * Copyright 2020 https://github.com/openapi-processor/openapi-processor-base
 * PDX-License-Identifier: Apache-2.0
 */

package io.openapiprocessor.test

/**
 * input.yaml / output.yaml items.
 */
class TestItems {

    private List items

    TestItems() {
    }

    private TestItems(List items) {
        this.items = items
    }

    List getItems() {
        return items
    }

    void setItems(List items) {
        this.items = items
    }

    /** convert to absolute paths */
    List addPrefix(String path) {
        items.collect {
            "${path}/${it}".toString ()
        }
    }

    TestItems resolvePlaceholder(String replacement) {
        def results = new TreeSet ()

        items.each {
            results.add(resolveModel(it, replacement))
        }

        return new TestItems(results as List)
    }

    private static String resolveModel(String path, String replacement) {
        return path.replaceFirst("", replacement)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy