Search in sources :

Example 56 with DeploymentConfig

use of io.fabric8.openshift.api.model.DeploymentConfig in project fabric8 by fabric8io.

the class KubernetesAssert method deployment.

/**
 * Asserts that there is a deployment of the given name
 *
 * @return the assertion object for the deployment
 */
public HasPodSelectionAssert deployment(String deploymentName) {
    String namespace = namespace();
    String qualifiedName = namespace + "." + deploymentName;
    OpenShiftClient openShiftClient = new Controller(client).getOpenShiftClientOrNull();
    if (openShiftClient != null && openShiftClient.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.APPS)) {
        DeploymentConfig deployment = openShiftClient.deploymentConfigs().inNamespace(namespace).withName(deploymentName).get();
        assertThat(deployment).describedAs("DeploymentConfig: " + qualifiedName).isNotNull().metadata().name().isEqualTo(deploymentName);
        return new DeploymentConfigPodsAssert(client, deployment);
    } else {
        Deployment deployment = client.extensions().deployments().inNamespace(namespace).withName(deploymentName).get();
        assertThat(deployment).describedAs("Deployment: " + qualifiedName).isNotNull().metadata().name().isEqualTo(deploymentName);
        return new DeploymentPodsAssert(client, deployment);
    }
}
Also used : OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) Deployment(io.fabric8.kubernetes.api.model.extensions.Deployment) Controller(io.fabric8.kubernetes.api.Controller) ReplicationController(io.fabric8.kubernetes.api.model.ReplicationController) DeploymentConfig(io.fabric8.openshift.api.model.DeploymentConfig)

Aggregations

DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)41 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)15 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)14 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)13 Service (io.fabric8.kubernetes.api.model.Service)13 Pod (io.fabric8.kubernetes.api.model.Pod)11 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)11 IOException (java.io.IOException)11 ReplicaSet (io.fabric8.kubernetes.api.model.extensions.ReplicaSet)9 Test (org.junit.Test)9 BuildConfig (io.fabric8.openshift.api.model.BuildConfig)8 DeploymentConfigSpec (io.fabric8.openshift.api.model.DeploymentConfigSpec)8 Route (io.fabric8.openshift.api.model.Route)8 List (java.util.List)8 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)7 IntOrString (io.fabric8.kubernetes.api.model.IntOrString)7 ImageStream (io.fabric8.openshift.api.model.ImageStream)7 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 Controller (io.fabric8.kubernetes.api.Controller)6