Search in sources :

Example 1 with CreateApplicationFromTemplateJob

use of org.jboss.tools.openshift.internal.ui.job.CreateApplicationFromTemplateJob in project jbosstools-openshift by jbosstools.

the class OpenShiftServiceRequirement method createService.

private IService createService(String serviceName, ITemplate template, String projectName, Connection connection) {
    LOGGER.debug(NLS.bind("Creating service in project {0} on server {1} using template {2}", new Object[] { projectName, connection.getHost(), template.getName() }));
    IProject project = OpenShift3NativeResourceUtils.getProject(projectName, connection);
    assertNotNull(project);
    CreateApplicationFromTemplateJob job = new CreateApplicationFromTemplateJob(project, template);
    job.schedule();
    new WaitWhile(new JobIsRunning(new Matcher[] { CoreMatchers.sameInstance(job) }), TimePeriod.LONG);
    new WaitUntil(new NamedResourceExist(ResourceKind.SERVICE, serviceName, projectName, connection), TimePeriod.VERY_LONG);
    return connection.getResource(ResourceKind.SERVICE, projectName, serviceName);
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) BaseMatcher(org.hamcrest.BaseMatcher) Matcher(org.hamcrest.Matcher) NamedResourceExist(org.jboss.tools.openshift.reddeer.condition.core.NamedResourceExist) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CreateApplicationFromTemplateJob(org.jboss.tools.openshift.internal.ui.job.CreateApplicationFromTemplateJob) IProject(com.openshift.restclient.model.IProject)

Aggregations

IProject (com.openshift.restclient.model.IProject)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)1 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)1 BaseMatcher (org.hamcrest.BaseMatcher)1 Matcher (org.hamcrest.Matcher)1 CreateApplicationFromTemplateJob (org.jboss.tools.openshift.internal.ui.job.CreateApplicationFromTemplateJob)1 NamedResourceExist (org.jboss.tools.openshift.reddeer.condition.core.NamedResourceExist)1