Search in sources :

Example 1 with OpenShiftProjectExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.

the class OpenShiftUtils method deleteAllProjects.

public static void deleteAllProjects(Connection connection) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.getOpenShift3Connection(connection).refresh();
    new WaitWhile(new JobIsRunning());
    List<OpenShiftProject> projects = explorer.getOpenShift3Connection(connection).getAllProjects();
    for (OpenShiftProject project : projects) {
        if (project != null) {
            String projectName = project.getName();
            try {
                project.delete();
                new WaitWhile(new OpenShiftProjectExists(projectName, connection), TimePeriod.LONG);
            } catch (CoreLayerException ex) {
                // project does not exist - project has been deleted but view has not been
                // refreshed
                explorer.getOpenShift3Connection(connection).refresh();
            }
        }
    }
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 2 with OpenShiftProjectExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.

the class OpenShiftProjectRequirement method cleanUp.

@Override
public void cleanUp() {
    if (projectSpec.cleanup()) {
        Connection connection = ConnectionUtils.getConnectionOrDefault(projectSpec.connectionURL());
        connection.deleteResource(project);
        new WaitWhile(new OpenShiftProjectExists(project.getName(), connection));
    }
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) Connection(org.jboss.tools.openshift.core.connection.Connection)

Example 3 with OpenShiftProjectExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.

the class OpenShift3NativeProjectUtils method createProject.

public static IProject createProject(String name, String displayName, String description, Connection connection) {
    assertTrue(StringUtils.isNotBlank(name));
    assertNotNull(displayName);
    assertNotNull(description);
    assertNotNull(connection);
    IProjectRequest request = connection.getResourceFactory().stub(ResourceKind.PROJECT_REQUEST, name);
    request.setDisplayName(StringUtils.isEmpty(displayName) ? name : displayName);
    request.setDescription(StringUtils.isEmpty(description) ? name : description);
    CreateProjectWaitCondition createProjectWaitCondition = new CreateProjectWaitCondition(connection, request);
    new WaitUntil(createProjectWaitCondition, TimePeriod.VERY_LONG);
    IProject createdProject = createProjectWaitCondition.getProject();
    /**
     * WORKAROUND: explorer wont get notified of the the new project and
     * therefore wont display it unless a manual refresh is done on the
     * connection. https://issues.jboss.org/browse/JBIDE-23513 remove
     * this wait once WatchManager is watching projects and notifies the
     * ui.
     *
     * @see WatchManager#KINDS
     */
    new WaitUntil(new OpenShiftProjectExists(createdProject.getDisplayName(), connection));
    return createdProject;
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) IProjectRequest(com.openshift.restclient.model.project.IProjectRequest) IProject(com.openshift.restclient.model.IProject)

Example 4 with OpenShiftProjectExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.

the class EditResourcesTest method tearDown.

public static void tearDown() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.reopen();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    connection.getProject().delete();
    try {
        new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()));
    } catch (WaitTimeoutExpiredException ex) {
        connection.refresh();
        new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()), TimePeriod.getCustom(5));
    }
    connection.createNewProject();
    ProjectExplorer projectExplorer = new ProjectExplorer();
    projectExplorer.open();
    if (projectExplorer.containsProject(PROJECT_NAME)) {
        projectExplorer.getProject(PROJECT_NAME).delete(true);
    }
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

Example 5 with OpenShiftProjectExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.

the class HandleCustomTemplateTest method cleanUp.

@After
public void cleanUp() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.reopen();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    connection.getProject().delete();
    try {
        new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()));
    } catch (WaitTimeoutExpiredException ex) {
        connection.refresh();
        new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()), TimePeriod.getCustom(5));
    }
    connection.createNewProject();
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) After(org.junit.After)

Aggregations

OpenShiftProjectExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists)5 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)3 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)2 IProject (com.openshift.restclient.model.IProject)1 IProjectRequest (com.openshift.restclient.model.project.IProjectRequest)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)1 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)1 Connection (org.jboss.tools.openshift.core.connection.Connection)1 OpenShiftProject (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject)1 After (org.junit.After)1