use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class ProfileUtilTest method simple.
@Test
public void simple() throws IOException {
InputStream is = getClass().getResourceAsStream("/fabric8/config/profiles-lookup-dir/profiles.yaml");
assertNotNull(is);
List<Profile> profiles = ProfileUtil.fromYaml(is);
assertNotNull(profiles);
assertEquals(profiles.size(), 2);
Profile profile = profiles.get(0);
assertEquals("simple", profile.getName());
ProcessorConfig config = profile.getEnricherConfig();
assertTrue(config.use("base"));
assertFalse(config.use("blub"));
config = profile.getGeneratorConfig();
assertFalse(config.use("java.app"));
assertTrue(config.use("spring.swarm"));
}
use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class ProfileUtilTest method blendProfiles.
@Test
public void blendProfiles() throws Exception {
ProcessorConfig origConfig = new ProcessorConfig(Arrays.asList("i1", "i2"), Collections.singleton("spring.swarm"), null);
ProcessorConfig mergeConfig = ProfileUtil.blendProfileWithConfiguration(ProfileUtil.ENRICHER_CONFIG, "simple", getProfileDir(), origConfig);
assertTrue(mergeConfig.use("base"));
assertTrue(mergeConfig.use("i1"));
assertEquals(mergeConfig.getConfig("base", "url"), "http://jolokia.org");
mergeConfig = ProfileUtil.blendProfileWithConfiguration(ProfileUtil.GENERATOR_CONFIG, "simple", getProfileDir(), origConfig);
assertTrue(mergeConfig.use("i2"));
assertFalse(mergeConfig.use("spring.swarm"));
}
use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testWithCustomConfigurationForLivenessAndReadinessComingFromConf.
@Test
public void testWithCustomConfigurationForLivenessAndReadinessComingFromConf() {
final ProcessorConfig config = new ProcessorConfig(null, null, Collections.singletonMap("vertx-health-check", new TreeMap(ImmutableMap.of(VertxHealthCheckEnricher.Config.path.name(), "health", VertxHealthCheckEnricher.Config.port.name(), "1234", VertxHealthCheckEnricher.Config.scheme.name(), "HTTPS", VertxHealthCheckEnricher.Config.readiness.name(), "/ready"))));
new Expectations() {
{
context.getConfig();
result = config;
}
};
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
Probe probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getScheme(), "HTTPS");
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 1234);
assertEquals(probe.getHttpGet().getPath(), "/health");
probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(probe.getHttpGet().getScheme(), "HTTPS");
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 1234);
assertEquals(probe.getHttpGet().getPath(), "/ready");
}
use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testWithCustomConfigurationComingFromConf.
@Test
public void testWithCustomConfigurationComingFromConf() {
final ProcessorConfig config = new ProcessorConfig(null, null, Collections.singletonMap("vertx-health-check", new TreeMap(ImmutableMap.of(VertxHealthCheckEnricher.Config.path.name(), "health", VertxHealthCheckEnricher.Config.port.name(), "1234", VertxHealthCheckEnricher.Config.scheme.name(), "HTTPS"))));
new Expectations() {
{
context.getConfig();
result = config;
}
};
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
Probe probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getScheme(), "HTTPS");
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 1234);
assertEquals(probe.getHttpGet().getPath(), "/health");
probe = enricher.getReadinessProbe();
assertNotNull(probe);
assertEquals(probe.getHttpGet().getScheme(), "HTTPS");
assertNull(probe.getHttpGet().getHost());
assertEquals(probe.getHttpGet().getPort().getIntVal().intValue(), 1234);
assertEquals(probe.getHttpGet().getPath(), "/health");
}
use of io.fabric8.maven.core.config.ProcessorConfig in project fabric8-maven-plugin by fabric8io.
the class VertxHealthCheckEnricherTest method testReadinessDisabledUsingConfig.
@Test
public void testReadinessDisabledUsingConfig() {
final ProcessorConfig config = new ProcessorConfig(null, null, Collections.singletonMap("vertx-health-check", new TreeMap(ImmutableMap.of(VertxHealthCheckEnricher.Config.readiness.name(), "", VertxHealthCheckEnricher.Config.path.name(), "/ping"))));
new Expectations() {
{
context.getConfig();
result = config;
}
};
VertxHealthCheckEnricher enricher = new VertxHealthCheckEnricher(context);
Probe probe = enricher.getLivenessProbe();
assertNotNull(probe);
assertEquals(probe.getHttpGet().getPath(), "/ping");
probe = enricher.getReadinessProbe();
assertNull(probe);
}
Aggregations