Class OpenShiftAssistant
java.lang.Object
org.arquillian.cube.kubernetes.impl.KubernetesAssistant
org.arquillian.cube.openshift.impl.client.OpenShiftAssistant
Class that allows you to deploy undeploy and wait for resources programmatically in a test.
-
Field Summary
Fields inherited from class org.arquillian.cube.kubernetes.impl.KubernetesAssistant
applicationName, client, namespace -
Method Summary
Modifier and TypeMethodDescriptionvoidAwaits at most 5 minutes until all pods of the last deployed application are running.voidawaitApplicationReadinessOrFail(String applicationName) Awaits at most 5 minutes until all pods of the application are running.voidWaits until the url responds with correct status codevoiddeploy(InputStream inputStream) Deploys application reading resources from specified InputStream.voiddeployApplication(String applicationName) Deploys application finding resources in default location in classpath.io.fabric8.openshift.api.model.DeploymentConfigMethod that returns the current deployment configuration objectOptional<io.fabric8.openshift.api.model.Project>findProject(String name) Finds for the given project.io.fabric8.openshift.client.OpenShiftClientGets the current OpenShift project used for deploying application.getRoute()Returns the URL of the first route.Gets the URL of the route with given name.List<io.fabric8.openshift.api.model.Project>Gets the list of all the OpenShift Projects.booleanprojectExists(String name) Checks if the given project exists or not.voidscale(int replicas) Scaling the last deployed application to given replicasvoidScaling the application to given replicasusingTemplate(String templateURL) Gets template URL string used for deploying application.usingTemplate(URL templateURL) Gets template URL used for deploying application.Methods inherited from class org.arquillian.cube.kubernetes.impl.KubernetesAssistant
awaitPodReadinessOrFail, cleanup, deploy, deployAll, deployAll, deployAll, deployAll, deployApplication, deployApplication, deployApplication, deployApplication, getPods, getServiceUrl, getServiceUrl, project, replicationController
-
Method Details
-
deployApplication
Deploys application finding resources in default location in classpath. That is: openshift.(y[a]ml|json), kubernetes.(y[a]ml|json), META-INF/fabric8/openshift.(y[a]ml|json), META-INF/fabric8/kubernetes.(y[a]ml|json) In this method yo specify the application name.- Overrides:
deployApplicationin classKubernetesAssistant- Parameters:
applicationName- to configure in cluster- Throws:
IOException
-
deploy
Deploys application reading resources from specified InputStream.- Overrides:
deployin classKubernetesAssistant- Parameters:
inputStream- where resources are read- Throws:
IOException
-
getRoute
Gets the URL of the route with given name.- Parameters:
routeName- to return its URL- Returns:
- URL backed by the route with given name.
-
getRoute
Returns the URL of the first route.- Returns:
- URL backed by the first route.
-
awaitUrl
Waits until the url responds with correct status code- Parameters:
routeUrl- URL to check (usually a route one)statusCodes- list of status code that might return that service is up and running. It is used as OR, so if one returns true, then the route is considered valid. If not set, then only 200 status code is used.
-
scale
public void scale(int replicas) Scaling the last deployed application to given replicas- Overrides:
scalein classKubernetesAssistant- Parameters:
replicas- to scale the application
-
scale
Scaling the application to given replicas- Overrides:
scalein classKubernetesAssistant- Parameters:
applicationName- name of the application to scalereplicas- to scale the application
-
awaitApplicationReadinessOrFail
public void awaitApplicationReadinessOrFail()Awaits at most 5 minutes until all pods of the last deployed application are running.- Overrides:
awaitApplicationReadinessOrFailin classKubernetesAssistant
-
awaitApplicationReadinessOrFail
Awaits at most 5 minutes until all pods of the application are running.- Overrides:
awaitApplicationReadinessOrFailin classKubernetesAssistant- Parameters:
applicationName- name of the application to wait for pods readiness
-
deploymentConfig
public io.fabric8.openshift.api.model.DeploymentConfig deploymentConfig()Method that returns the current deployment configuration object- Returns:
- Current deployment config object.
-
usingTemplate
Gets template URL used for deploying application.- Parameters:
templateURL- url path to the template- Returns:
- OpenShiftAssistantTemplate object.
-
usingTemplate
Gets template URL string used for deploying application.- Parameters:
templateURL- path to the template- Returns:
- OpenShiftAssistantTemplate object.
- Throws:
MalformedURLException
-
listProjects
Gets the list of all the OpenShift Projects.- Returns:
- list of OpenShift Projects.
-
getCurrentProjectName
Gets the current OpenShift project used for deploying application.- Returns:
- current namespace.
-
projectExists
Checks if the given project exists or not.- Parameters:
name- project name- Returns:
- true/false
- Throws:
IllegalArgumentException
-
findProject
public Optional<io.fabric8.openshift.api.model.Project> findProject(String name) throws IllegalArgumentException Finds for the given project.- Parameters:
name- project name- Returns:
- given project or an empty
Optionalif project does not exist - Throws:
IllegalArgumentException
-
getClient
public io.fabric8.openshift.client.OpenShiftClient getClient()
-