use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class GeneratorManagerTest method setUp.
@Before
public void setUp() throws Exception {
final ProcessorConfig processorConfig = new ProcessorConfig();
processorConfig.setIncludes(Collections.singletonList("fake-generator"));
generatorContext = GeneratorContext.builder().config(processorConfig).logger(logger).build();
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class PrometheusEnricherTest method testCustomPrometheusPort.
@Test
public void testCustomPrometheusPort() {
// Given
initContext(new ProcessorConfig(null, null, Collections.singletonMap("jkube-prometheus", Collections.singletonMap("prometheusPort", "1234"))), null);
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", "1234").containsEntry("prometheus.io/scrape", "true").containsEntry("prometheus.io/path", "/metrics");
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class QuarkusHealthCheckEnricherTest method setUp.
@SuppressWarnings("ResultOfMethodCallIgnored")
@Before
public void setUp() {
properties = new Properties();
processorConfig = new ProcessorConfig();
klb = new KubernetesListBuilder();
// @formatter:off
klb.addToItems(new DeploymentBuilder().editOrNewSpec().editOrNewTemplate().editOrNewMetadata().withName("template-name").endMetadata().editOrNewSpec().addNewContainer().withImage("container/image").endContainer().endSpec().endTemplate().endSpec().build());
new Expectations() {
{
context.getProperties();
result = properties;
context.getConfiguration().getProcessorConfig();
result = processorConfig;
javaProject.getProperties();
result = properties;
minTimes = 0;
javaProject.getOutputDirectory();
result = new File("/tmp/ignored");
minTimes = 0;
}
};
// @formatter:on
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class KarafGeneratorTest method customizeWithKarafMavenPluginShouldAddImageConfiguration.
@Test
public void customizeWithKarafMavenPluginShouldAddImageConfiguration(@Mocked Plugin plugin) {
// Given
final List<ImageConfiguration> originalImageConfigurations = new ArrayList<>();
// @formatter:off
new Expectations() {
{
plugin.getGroupId();
result = "org.apache.karaf.tooling";
minTimes = 0;
plugin.getArtifactId();
result = "karaf-maven-plugin";
minTimes = 0;
generatorContext.getProject().getPlugins();
result = Collections.singletonList(plugin);
minTimes = 0;
generatorContext.getProject().getBuildDirectory();
result = temporaryFolder.getRoot();
generatorContext.getProject().getVersion();
result = "1.33.7-SNAPSHOT";
generatorContext.getConfig();
result = new ProcessorConfig();
}
};
// @formatter:on
// When
final List<ImageConfiguration> result = new KarafGenerator(generatorContext).customize(originalImageConfigurations, false);
// Then
assertThat(originalImageConfigurations, sameInstance(result));
assertThat(result, hasSize(1));
final ImageConfiguration imageConfiguration = result.iterator().next();
assertThat(imageConfiguration.getName(), equalTo("%g/%a:%l"));
assertThat(imageConfiguration.getAlias(), equalTo("karaf"));
final BuildConfiguration bc = imageConfiguration.getBuildConfiguration();
assertThat(bc.getTags(), contains("latest"));
assertThat(bc.getPorts(), contains("8181", "8778"));
assertThat(bc.getEnv(), hasEntry("DEPLOYMENTS_DIR", "/deployments"));
assertThat(bc.getEnv(), hasEntry("KARAF_HOME", "/deployments/karaf"));
final AssemblyConfiguration ac = bc.getAssembly();
assertThat(ac.getName(), equalTo("deployments"));
assertThat(ac.isExcludeFinalOutputArtifact(), equalTo(false));
assertThat(ac.getLayers(), hasSize(1));
assertThat(ac.getLayers().iterator().next().getFileSets(), contains(allOf(hasProperty("directory", equalTo(new File(temporaryFolder.getRoot(), "assembly"))), hasProperty("outputDirectory", equalTo(new File("karaf"))), hasProperty("directoryMode", equalTo("0775"))), allOf(hasProperty("directory", equalTo(temporaryFolder.getRoot().toPath().resolve("assembly").resolve("bin").toFile())), hasProperty("outputDirectory", equalTo(new File("karaf", "bin"))), hasProperty("fileMode", equalTo("0777")), hasProperty("directoryMode", equalTo("0775")))));
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class ThorntailV2HealthCheckEnricherTest method setUp.
@Before
public void setUp() {
properties = new Properties();
processorConfig = new ProcessorConfig();
klb = new KubernetesListBuilder();
// @formatter:off
klb.addToItems(new DeploymentBuilder().editOrNewSpec().editOrNewTemplate().editOrNewMetadata().withName("template-name").endMetadata().editOrNewSpec().addNewContainer().withImage("container/image").endContainer().endSpec().endTemplate().endSpec().build());
new Expectations() {
{
context.getProperties();
result = properties;
context.getConfiguration().getProcessorConfig();
result = processorConfig;
context.hasDependency("io.thorntail", "monitor");
result = true;
context.getProjectClassLoaders();
result = new ProjectClassLoaders(new URLClassLoader(new URL[0], ThorntailV2HealthCheckEnricherTest.class.getClassLoader()));
}
};
// @formatter:on
}
Aggregations