package io.lumify.core.config;

import io.lumify.test.LumifyTestCluster;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class LumifyTestClusterConfigurationLoader extends ConfigurationLoader {
    private static Properties props;

    static {
        try {
            props = new Properties();
            props.load(LumifyTestClusterConfigurationLoader.class.getResourceAsStream("/io/lumify/test/lumify.properties"));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public LumifyTestClusterConfigurationLoader() {
        this(new HashMap());
    }

    public LumifyTestClusterConfigurationLoader(Map initParameters) {
        super(initParameters);
    }

    @Override
    public Configuration createConfiguration() {
        return new Configuration(this, props);
    }

    @Override
    public File resolveFileName(String fileName) {
        try {
            URL rootUrl = LumifyTestCluster.class.getResource(fileName);
            return new File(rootUrl.toURI());
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
    }

    public static Properties getConfigurationProperties() {
        return props;
    }
}

@@ -1114,24 +1114,183 @@
 (fileName);%0A
+            if (rootUrl == null %7C%7C rootUrl.toURI() == null) %7B%0A                throw new RuntimeException(%22Could not resolve file: %22 + fileName);%0A            %7D%0A
             

add error check to resolveFileName to debug jenkins