forked from arquillian/arquillian-cube
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes arquillian#815: defer choice of configuration url to a later stage
- Loading branch information
1 parent
bcd6ea9
commit eacb5b9
Showing
3 changed files
with
18 additions
and
22 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
21 changes: 10 additions & 11 deletions
21
...n/java/org/arquillian/cube/openshift/impl/locator/OpenshiftKubernetesResourceLocator.java
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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
package org.arquillian.cube.openshift.impl.locator; | ||
|
||
import org.arquillian.cube.kubernetes.api.KubernetesResourceLocator; | ||
import io.fabric8.kubernetes.clnt.v2_6.KubernetesClient; | ||
import io.fabric8.openshift.clnt.v2_6.OpenShiftClient; | ||
import org.arquillian.cube.kubernetes.impl.locator.DefaultKubernetesResourceLocator; | ||
import org.jboss.arquillian.core.api.Instance; | ||
import org.jboss.arquillian.core.api.annotation.Inject; | ||
|
||
public class OpenshiftKubernetesResourceLocator extends DefaultKubernetesResourceLocator { | ||
|
||
private static final String[] RESOURCE_NAMES = | ||
new String[] {"openshift", "META-INF/fabric8/openshift", "kubernetes", "META-INF/fabric8/kubernetes"}; | ||
private static final String[] ALLOWED_SUFFIXES = {".json", ".yml", ".yaml"}; | ||
|
||
@Inject | ||
protected Instance<KubernetesClient> client; | ||
|
||
@Override | ||
protected String[] getResourceNames() { | ||
if (!client.get().isAdaptable(OpenShiftClient.class)) { | ||
return super.getResourceNames(); | ||
} | ||
return RESOURCE_NAMES; | ||
} | ||
|
||
@Override | ||
protected String[] getAllowedSuffixes() { | ||
return ALLOWED_SUFFIXES; | ||
} | ||
|
||
@Override | ||
public KubernetesResourceLocator toImmutable() { | ||
return this; | ||
} | ||
} |