Search in sources :

Example 11 with OpenShift3Connection

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection 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 12 with OpenShift3Connection

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection 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)

Example 13 with OpenShift3Connection

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection in project jbosstools-openshift by jbosstools.

the class PortForwardingTest method openPortForwardingDialog.

private void openPortForwardingDialog() {
    OpenShift3Connection openShift3Connection = new OpenShiftExplorerView().getOpenShift3Connection(connectionReq.getConnection());
    ApplicationPodIsRunning applicationPodIsRunning = new ApplicationPodIsRunning(openShift3Connection.getProject(projectReq.getProjectName()));
    new WaitUntil(applicationPodIsRunning, TimePeriod.LONG);
    openShift3Connection.getProject(projectReq.getProjectName()).getOpenShiftResource(Resource.POD, applicationPodIsRunning.getApplicationPodName()).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.PORT_FORWARD).select();
    new DefaultShell(OpenShiftLabel.Shell.APPLICATION_PORT_FORWARDING);
}
Also used : ApplicationPodIsRunning(org.jboss.tools.openshift.reddeer.condition.ApplicationPodIsRunning) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

Example 14 with OpenShift3Connection

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection in project jbosstools-openshift by jbosstools.

the class OpenShiftServiceRequirement method waitForUI.

/**
 * Waits for the service and replication controller to appear in the UI,
 * possibly refreshes the project. This shouldnt be required but turns out
 * that the UI takes extensive amount of time to notice the new resources.
 * We therefore make sure they are present in UI before considering this
 * requirement as fullfilled and possibly refresh the project (in ui) to
 * force it to appear. This shouldnt be necessary, I consider this as workaround.
 *
 * @param projectName
 * @param serviceName
 */
private void waitForUI(final String serviceName, final String projectName) {
    // wait for service to appear in UI
    new WaitUntil(new AbstractWaitCondition() {

        @Override
        public boolean test() {
            OpenShiftExplorerView explorer = new OpenShiftExplorerView();
            explorer.open();
            OpenShift3Connection os3Connection = explorer.getOpenShift3Connection(connection);
            assertThat(os3Connection, not(nullValue()));
            OpenShiftProject os3Project = os3Connection.getProject(projectName);
            assertThat(os3Project, not(nullValue()));
            boolean serviceExists = false;
            try {
                serviceExists = os3Project.getService(serviceName) != null;
            } catch (RedDeerException e) {
                // catched intentionnally
                System.err.println(e);
            }
            /*
						 * WORKAROUND: UI takes extensive amount of time to notice resource changes
						 * -> refresh tree to force it to see changes
						 */
            if (!serviceExists) {
                os3Project.refresh();
            }
            return serviceExists;
        }
    }, TimePeriod.VERY_LONG);
    // wait for replication controller to appear in UI
    List<IReplicationController> rcs = connection.getResources(ResourceKind.REPLICATION_CONTROLLER, service.getNamespaceName());
    IReplicationController serviceRc = ResourceUtils.getReplicationControllerFor(service, rcs);
    assertThat(serviceRc, not(nullValue()));
    new WaitUntil(new OpenShiftResourceExists(Resource.DEPLOYMENT, containsString(serviceRc.getName()), ResourceState.UNSPECIFIED, projectName, connection), TimePeriod.VERY_LONG);
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) AbstractWaitCondition(org.eclipse.reddeer.common.condition.AbstractWaitCondition) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) IReplicationController(com.openshift.restclient.model.IReplicationController) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

Example 15 with OpenShift3Connection

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection in project jbosstools-openshift by jbosstools.

the class AbstractBotTests method cleanUp.

@AfterClass
public static void cleanUp() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    if (connection != null) {
        for (OpenShiftProject project : connection.getAllProjects()) {
            safeDeleteProject(project, connection);
        }
        new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    }
}
Also used : 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) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) AfterClass(org.junit.AfterClass)

Aggregations

OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)21 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)19 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)8 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)7 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)7 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)7 Test (org.junit.Test)7 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)5 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)5 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)5 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)5 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)3 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)3 After (org.junit.After)3 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)2 PropertySheet (org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet)2 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)2 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)2