use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class ConfigMapEnricherTest method should_materialize_file_content_from_xml.
@Test
public void should_materialize_file_content_from_xml() throws Exception {
final org.eclipse.jkube.kit.config.resource.ConfigMap baseConfigMap = createXmlConfigMap("src/test/resources/test-application.properties");
final ResourceConfig config = ResourceConfig.builder().configMap(baseConfigMap).build();
new Expectations() {
{
context.getConfiguration();
result = Configuration.builder().resource(config).build();
}
};
final KubernetesListBuilder builder = new KubernetesListBuilder();
new ConfigMapEnricher(context).create(PlatformMode.kubernetes, builder);
final ConfigMap configMap = (ConfigMap) builder.buildFirstItem();
final Map<String, String> data = configMap.getData();
assertThat(data).containsEntry("test-application.properties", readFileContentsAsString("src/test/resources/test-application.properties"));
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class ConfigMapEnricherTest method should_materialize_binary_file_content_from_xml.
@Test
public void should_materialize_binary_file_content_from_xml() {
final org.eclipse.jkube.kit.config.resource.ConfigMap baseConfigMap = createXmlConfigMap("src/test/resources/test.bin");
final ResourceConfig config = ResourceConfig.builder().configMap(baseConfigMap).build();
new Expectations() {
{
context.getConfiguration();
result = Configuration.builder().resource(config).build();
}
};
final KubernetesListBuilder builder = new KubernetesListBuilder();
new ConfigMapEnricher(context).create(PlatformMode.kubernetes, builder);
final ConfigMap configMap = (ConfigMap) builder.buildFirstItem();
final Map<String, String> data = configMap.getData();
assertNull(data);
final Map<String, String> binaryData = configMap.getBinaryData();
assertThat(binaryData).containsEntry("test.bin", "wA==");
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class IngressEnricherTest method testGetRouteDomainFromResourceConfig.
@Test
public void testGetRouteDomainFromResourceConfig() {
// Given
ResourceConfig resourceConfig = ResourceConfig.builder().routeDomain("org.eclipse.jkube").build();
// When
String result = ingressEnricher.getRouteDomain(resourceConfig);
// Then
assertThat(result).isEqualTo("org.eclipse.jkube");
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class IngressEnricherTest method testGetIngressTlsXMLConfigWithNonNullResourceConfig.
@Test
public void testGetIngressTlsXMLConfigWithNonNullResourceConfig() {
// Given
ResourceConfig resourceConfig = ResourceConfig.builder().ingress(IngressConfig.builder().ingressTlsConfig(IngressTlsConfig.builder().secretName("secret1").build()).build()).build();
// When
List<IngressTlsConfig> ingressTlsConfigs = IngressEnricher.getIngressTlsXMLConfig(resourceConfig);
// Then
assertThat(ingressTlsConfigs).asList().hasSize(1);
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class BaseEnricherGetReplicaCountTest method withDeploymentConfigInListBuilderAndEmptyResourceConfigShouldReturnDeploymentConfig.
@Test
public void withDeploymentConfigInListBuilderAndEmptyResourceConfigShouldReturnDeploymentConfig() {
// Given
final KubernetesListBuilder klb = new KubernetesListBuilder().addToItems(new DeploymentConfigBuilder().withNewSpec().withReplicas(1).endSpec());
final ResourceConfig resourceConfig = ResourceConfig.builder().replicas(313373).build();
// When
final int result = getReplicaCount(klb, resourceConfig, 1337);
// Then
assertThat(result).isEqualTo(1);
}
Aggregations