use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class FromSelectorTest method simple.
@Test
public void simple() {
final TestCase[] testCases = new TestCase[] { new TestCase(OPENSHIFT, s2i, "s2i-prop", "istag-prop"), new TestCase(OPENSHIFT, docker, "docker-prop", "istag-prop"), new TestCase(null, s2i, "docker-prop", "istag-prop"), new TestCase(null, docker, "docker-prop", "istag-prop"), new TestCase(OPENSHIFT, null, "docker-prop", "istag-prop"), new TestCase(OPENSHIFT, null, "docker-prop", "istag-prop"), new TestCase(null, null, "docker-prop", "istag-prop"), new TestCase(null, null, "docker-prop", "istag-prop") };
for (TestCase tc : testCases) {
GeneratorContext ctx = GeneratorContext.builder().project(project).config(new ProcessorConfig()).logger(logger).runtimeMode(tc.runtimeMode).strategy(tc.strategy).build();
FromSelector selector = new FromSelector.Default(ctx, "test");
assertEquals(tc.expectedFrom, selector.getFrom());
Map<String, String> fromExt = selector.getImageStreamTagFromExt();
assertEquals(3, fromExt.size());
assertEquals("ImageStreamTag", fromExt.get(JKubeBuildStrategy.SourceStrategy.kind.key()));
assertEquals("openshift", fromExt.get(JKubeBuildStrategy.SourceStrategy.namespace.key()));
assertEquals(tc.expectedName, fromExt.get(JKubeBuildStrategy.SourceStrategy.name.key()));
}
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class BaseGeneratorTest method setUp.
@Before
public void setUp() {
properties = new Properties();
config = new ProcessorConfig();
// @formatter:off
new Expectations() {
{
ctx.getProject().getProperties();
result = properties;
ctx.getConfig();
result = config;
}
};
// @formatter:on
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class PrometheusEnricherTest method testCustomPrometheusPath.
@Test
public void testCustomPrometheusPath() {
// Given
initContext(new ProcessorConfig(null, null, Collections.singletonMap("jkube-prometheus", Collections.singletonMap("prometheusPath", "/prometheus"))), ImageConfiguration.builder().build(BuildConfiguration.builder().ports(Arrays.asList("1337", null, " ", "9779", null)).build()).build());
final KubernetesListBuilder builder = new KubernetesListBuilder().withItems(new ServiceBuilder().withNewMetadata().withName("foo").endMetadata().build());
// When
prometheusEnricher.create(PlatformMode.kubernetes, builder);
// Then
assertThat(builder.buildFirstItem().getMetadata().getAnnotations()).hasSize(3).containsEntry("prometheus.io/port", "9779").containsEntry("prometheus.io/scrape", "true").containsEntry("prometheus.io/path", "/prometheus");
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class ServiceDiscoveryEnricherTest method setUp.
@SuppressWarnings("ResultOfMethodCallIgnored")
@Before
public void setUp() {
Map<String, Object> configMap = new HashMap<>();
configMap.put("path", path);
configMap.put("port", port);
configMap.put("scheme", scheme);
configMap.put("descriptionPath", descriptionPath);
configMap.put("discoverable", discoverable);
configMap.put("discoveryVersion", discoveryVersion);
ProcessorConfig processorConfig = new ProcessorConfig(null, null, Collections.singletonMap("jkube-service-discovery", configMap));
// Setup mock behaviour
new Expectations() {
{
context.getConfiguration().getProcessorConfig();
result = processorConfig;
}
};
enricher = new ServiceDiscoveryEnricher(context);
builder = new ServiceBuilder();
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class JavaExecGeneratorMainClassDeterminationTest method setUp.
@Before
public void setUp() {
processorConfig = new ProcessorConfig();
// @formatter:off
new Expectations() {
{
project.getVersion();
result = "1.33.7-SNAPSHOT";
project.getOutputDirectory();
result = "/the/output/directory";
}
};
// @formatter:on
}
Aggregations