use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class DaemonSetHandlerTest method daemonTemplateHandlerWithoutControllerTest.
@Test(expected = IllegalArgumentException.class)
public void daemonTemplateHandlerWithoutControllerTest() {
// without controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
DaemonSetHandler daemonSetHandler = new DaemonSetHandler(podTemplateHandler);
// without controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").withServiceAccount("test-account").volumes(volumes1).build();
daemonSetHandler.getDaemonSet(config, images);
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class DeploymentHandlerTest method deploymentTemplateHandlerTest.
@Test
public void deploymentTemplateHandlerTest() {
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
DeploymentHandler deploymentHandler = new DeploymentHandler(podTemplateHandler);
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").controllerName("testing").withServiceAccount("test-account").withReplicas(5).volumes(volumes1).build();
Deployment deployment = deploymentHandler.getDeployment(config, images);
// Assertion
assertNotNull(deployment.getSpec());
assertNotNull(deployment.getMetadata());
assertEquals(5, deployment.getSpec().getReplicas().intValue());
assertNotNull(deployment.getSpec().getTemplate());
assertEquals("testing", deployment.getMetadata().getName());
assertEquals("test-account", deployment.getSpec().getTemplate().getSpec().getServiceAccountName());
assertFalse(deployment.getSpec().getTemplate().getSpec().getVolumes().isEmpty());
assertEquals("test", deployment.getSpec().getTemplate().getSpec().getVolumes().get(0).getName());
assertEquals("/test/path", deployment.getSpec().getTemplate().getSpec().getVolumes().get(0).getHostPath().getPath());
assertNotNull(deployment.getSpec().getTemplate().getSpec().getContainers());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class DeploymentHandlerTest method deploymentTemplateHandlerWithoutControllerTest.
@Test(expected = IllegalArgumentException.class)
public void deploymentTemplateHandlerWithoutControllerTest() {
// without controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
DeploymentHandler deploymentHandler = new DeploymentHandler(podTemplateHandler);
// without controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").withServiceAccount("test-account").withReplicas(5).volumes(volumes1).build();
deploymentHandler.getDeployment(config, images);
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class EnvVarHandlerTest method envVarHandlerTest.
@Test
public void envVarHandlerTest() {
// Some Environment Variable in Config
EnvVar var1 = new EnvVarBuilder().withName("TEST1").withValue("OK").build();
EnvVar var2 = new EnvVarBuilder().withName("TEST2").withValue("DONE").build();
EnvVar var3 = new EnvVarBuilder().withName("TEST3").withValue("").build();
env.clear();
env.put(var1.getName(), var1.getValue());
env.put(var2.getName(), var2.getValue());
env.put(var3.getName(), var3.getValue());
EnvVarHandler envVarHandler = new EnvVarHandler(project);
new Expectations() {
{
externalEnvVarHandler.getExportedEnvironmentVariables(project, env);
ret.putAll(env);
result = ret;
}
};
List<EnvVar> envVars = envVarHandler.getEnvironmentVariables(env);
assertNotNull(envVars);
assertEquals(4, envVars.size());
assertTrue(envVars.contains(var1));
assertTrue(envVars.contains(var2));
assertTrue(envVars.contains(var3));
assertTrue(envVars.contains(var4));
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class JobHandlerTest method daemonTemplateHandlerWithoutControllerTest.
@Test(expected = IllegalArgumentException.class)
public void daemonTemplateHandlerWithoutControllerTest() {
// without controller name
ContainerHandler containerHandler = new ContainerHandler(project, envVarHandler, probeHandler);
PodTemplateHandler podTemplateHandler = new PodTemplateHandler(containerHandler);
JobHandler jobHandler = new JobHandler(podTemplateHandler);
// without controller name
ResourceConfig config = new ResourceConfig.Builder().imagePullPolicy("IfNotPresent").withServiceAccount("test-account").volumes(volumes1).build();
jobHandler.getJob(config, images);
}
Aggregations