io.dekorate.testing.adapter.KubernetesIntegrationTestConfigAdapter Maven / Gradle / Ivy
package io.dekorate.testing.adapter;
import io.dekorate.testing.annotation.KubernetesIntegrationTest;
import java.util.stream.Collectors;
import io.dekorate.testing.config.KubernetesIntegrationTestConfig;
import java.lang.Object;
import java.util.List;
import io.dekorate.testing.config.KubernetesIntegrationTestConfigBuilder;
import java.lang.String;
import java.util.Arrays;
import java.util.Map;
/**
* Generated
*/
public class KubernetesIntegrationTestConfigAdapter{
public static KubernetesIntegrationTestConfig adapt(KubernetesIntegrationTest instance) {
return newBuilder(instance).build();
}
public static KubernetesIntegrationTestConfigBuilder newBuilder(io.dekorate.testing.annotation.KubernetesIntegrationTest instance) {
return new KubernetesIntegrationTestConfigBuilder(new io.dekorate.testing.config.KubernetesIntegrationTestConfig(instance.deployEnabled(),
instance.buildEnabled(),
instance.readinessTimeout(),
instance.additionalModules()));
}
public static io.dekorate.testing.config.KubernetesIntegrationTestConfig adapt(Map map) {
return new io.dekorate.testing.config.KubernetesIntegrationTestConfig(
java.lang.Boolean.parseBoolean(String.valueOf(map instanceof Map ? ((Map)map).getOrDefault("deployEnabled","false") : "false")),
java.lang.Boolean.parseBoolean(String.valueOf(map instanceof Map ? ((Map)map).getOrDefault("buildEnabled","false") : "false")),
java.lang.Long.parseLong(String.valueOf(map instanceof Map ? ((Map)map).getOrDefault("readinessTimeout","0") : "0")),
map instanceof Map ? toStringArray(((Map)map).get("additionalModules")) : toStringArray(map));
}
public static String[] toStringArray(Object o) {
if (o instanceof String[]) {
return (String[]) o;
}
if (o instanceof String) {
String s = (String) o;
return s.split(",[ ]*");
}
else if (o instanceof List) {
List c = (List) o;
String[] result = new String[c.size()];
for (int i=0; i <= c.size(); i++) {
result[i] = String.valueOf(c.get(i));
}
return result;
}
return new String[0];
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy