use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class AbstractSpringBootHealthCheckEnricherTestSupport method testCustomInitialDelayForLivenessAndReadinessAndTimeout.
@Test
public void testCustomInitialDelayForLivenessAndReadinessAndTimeout() {
Map<String, Map<String, Object>> globalConfig = new HashMap<>();
TreeMap<String, Object> enricherConfig = new TreeMap<>();
globalConfig.put(SpringBootHealthCheckEnricher.ENRICHER_NAME, enricherConfig);
enricherConfig.put("readinessProbeInitialDelaySeconds", "20");
enricherConfig.put("livenessProbeInitialDelaySeconds", "360");
enricherConfig.put("timeoutSeconds", "120");
final ProcessorConfig config = new ProcessorConfig(null, null, globalConfig);
new Expectations() {
{
context.getConfiguration();
result = Configuration.builder().processorConfig(config).build();
context.getProjectClassLoaders();
result = new ProjectClassLoaders(new URLClassLoader(new URL[0], AbstractSpringBootHealthCheckEnricherTestSupport.class.getClassLoader())) {
@Override
public boolean isClassInCompileClasspath(boolean all, String... clazz) {
return true;
}
};
}
};
withProjectProperties(new Properties());
SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
Probe probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(20, probe.getInitialDelaySeconds().intValue());
assertNull(probe.getPeriodSeconds());
assertEquals(120, probe.getTimeoutSeconds().intValue());
probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertEquals(360, probe.getInitialDelaySeconds().intValue());
assertNull(probe.getPeriodSeconds());
assertEquals(120, probe.getTimeoutSeconds().intValue());
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class AbstractSpringBootHealthCheckEnricherTestSupport method testCustomPropertiesForLivenessAndReadiness.
@Test
public void testCustomPropertiesForLivenessAndReadiness() {
Map<String, Map<String, Object>> globalConfig = new HashMap<>();
TreeMap<String, Object> enricherConfig = new TreeMap<>();
globalConfig.put(SpringBootHealthCheckEnricher.ENRICHER_NAME, enricherConfig);
enricherConfig.put("readinessProbeInitialDelaySeconds", "30");
enricherConfig.put("readinessProbePeriodSeconds", "40");
enricherConfig.put("livenessProbeInitialDelaySeconds", "460");
enricherConfig.put("livenessProbePeriodSeconds", "50");
final ProcessorConfig config = new ProcessorConfig(null, null, globalConfig);
new Expectations() {
{
context.getConfiguration();
result = Configuration.builder().processorConfig(config).build();
context.getProjectClassLoaders();
result = new ProjectClassLoaders(new URLClassLoader(new URL[0], AbstractSpringBootHealthCheckEnricherTestSupport.class.getClassLoader())) {
@Override
public boolean isClassInCompileClasspath(boolean all, String... clazz) {
return true;
}
};
}
};
withProjectProperties(new Properties());
SpringBootHealthCheckEnricher enricher = new SpringBootHealthCheckEnricher(context);
Probe probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(30, probe.getInitialDelaySeconds().intValue());
assertEquals(40, probe.getPeriodSeconds().intValue());
probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertEquals(460, probe.getInitialDelaySeconds().intValue());
assertEquals(50, probe.getPeriodSeconds().intValue());
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class WildflyJARHealthCheckEnricherTest method setupExpectations.
private void setupExpectations(Map<String, Map<String, Object>> jkubeConfig) {
ProcessorConfig c = new ProcessorConfig(null, null, jkubeConfig);
new Expectations() {
{
Configuration.ConfigurationBuilder configBuilder = Configuration.builder();
configBuilder.processorConfig(c);
context.getConfiguration();
result = configBuilder.build();
}
};
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class WildflyJARHealthCheckEnricherTest method setupExpectations.
private void setupExpectations(JavaProject project, Map<String, Object> bootableJarconfig, Map<String, Map<String, Object>> jkubeConfig) {
Plugin plugin = Plugin.builder().artifactId(WildflyJARHealthCheckEnricher.BOOTABLE_JAR_ARTIFACT_ID).groupId(WildflyJARHealthCheckEnricher.BOOTABLE_JAR_GROUP_ID).configuration(bootableJarconfig).build();
List<Plugin> lst = new ArrayList<>();
lst.add(plugin);
ProcessorConfig c = new ProcessorConfig(null, null, jkubeConfig);
new Expectations() {
{
project.getPlugins();
result = lst;
context.getProject();
result = project;
Configuration.ConfigurationBuilder configBuilder = Configuration.builder();
configBuilder.processorConfig(c);
context.getConfiguration();
result = configBuilder.build();
}
};
}
use of org.eclipse.jkube.kit.config.resource.ProcessorConfig in project jkube by eclipse.
the class WildflyJARGeneratorTest method contextForSlimServer.
private GeneratorContext contextForSlimServer(JavaProject project, Map<String, Object> bootableJarconfig, Path dir) {
Plugin plugin = Plugin.builder().artifactId(WildflyJARHealthCheckEnricher.BOOTABLE_JAR_ARTIFACT_ID).groupId(WildflyJARHealthCheckEnricher.BOOTABLE_JAR_GROUP_ID).configuration(bootableJarconfig).build();
List<Plugin> lst = new ArrayList<>();
lst.add(plugin);
ProcessorConfig c = new ProcessorConfig(null, null, Collections.emptyMap());
if (dir == null) {
new Expectations() {
{
project.getPlugins();
result = lst;
context.getProject();
result = project;
}
};
} else {
new Expectations() {
{
project.getPlugins();
result = lst;
project.getBaseDirectory();
result = dir.toFile();
context.getProject();
result = project;
}
};
}
return context;
}
Aggregations