package org.arquillian.cube.kubernetes.impl.locator;

import org.arquillian.cube.kubernetes.api.KubernetesResourceLocator;

import java.net.URL;

public class DefaultKubernetesResouceLocator implements KubernetesResourceLocator {

    private static final String ROOT = "/";
    private static final String RESOURCE_NAME = "kubernetes";
    private static final String[] ALLOWED_SUFFIXES = {".json", ".yml", ".yaml"};


    @Override
    public URL locate() {
        for (String suffix : ALLOWED_SUFFIXES) {
            URL candidate = getResource(RESOURCE_NAME + suffix);
            if (candidate != null) {
                return candidate;
            }
        }
        return null;
    }


    URL getResource(String resource) {
        return KubernetesResourceLocator.class.getResource(resource.startsWith(ROOT) ? resource : ROOT + resource);
    }

}

@@ -299,16 +299,18 @@
 l String
+%5B%5D
  RESOURC
@@ -319,23 +319,72 @@
 NAME
+S
  = 
-%22kubernetes%22
+new String%5B%5D %7B %22kubernetes%22, %22META-INF/fabric8/kubernetes%22 %7D
 ;%0A  
@@ -463,17 +463,16 @@
 aml%22%7D;%0A%0A
-%0A
     @Ove
@@ -548,24 +548,81 @@
 SUFFIXES) %7B%0A
+            for (String resource : RESOURCE_NAMES) %7B%0A    
             
@@ -649,29 +649,24 @@
 esource(
-RESOURCE_NAME
+resource
  + suffi
@@ -681,16 +681,20 @@
         
+    
 if (cand
@@ -722,24 +722,28 @@
             
+    
 return candi
@@ -748,16 +748,34 @@
 didate;%0A
+                %7D%0A
         
@@ -818,17 +818,16 @@
 %0A    %7D%0A%0A
-%0A
     URL 
@@ -973,17 +973,16 @@
 ource);%0A
+
     %7D%0A
-%0A
 %7D%0A

Add support for the f-m-p version 3.x. (#534)