Search in sources :

Example 16 with OpenShiftToolsException

use of org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method testOpenshiftConnection.

/**
 * Tests Openshift 3 connection and try to refresh it
 *
 * @param connection
 */
public void testOpenshiftConnection(String server, String username) {
    OpenShift3Connection connection = null;
    try {
        connection = findOpenShiftConnection(server, username);
    } catch (OpenShiftToolsException toolsExc) {
        fail(toolsExc.getMessage());
    }
    // usually, when server adapter is not started, openshift connection after refresh should cause
    // problem occurred dialog
    connection.refresh();
    try {
        // $NON-NLS-1$
        new WaitUntil(new ShellIsAvailable("Problem occurred"), TimePeriod.getCustom(30));
        CDKUtils.captureScreenshot("CDKServerAdapterAbstractTest#testOpenshiftConnection");
        new DefaultShell("Problem occurred").close();
        // $NON-NLS-1$
        fail("Problem dialog occured when refreshing OpenShift connection");
    } catch (WaitTimeoutExpiredException ex) {
        // no dialog appeared, which is ok
        // $NON-NLS-1$
        log.info("Expected WaitTimeoutExpiredException occured");
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

Aggregations

OpenShiftToolsException (org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException)16 File (java.io.File)7 IOException (java.io.IOException)4 MalformedURLException (java.net.MalformedURLException)3 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 ServerAdapter (org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter)3 FileOutputStream (java.io.FileOutputStream)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ZipFile (java.util.zip.ZipFile)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 ConnectionURL (org.jboss.tools.openshift.common.core.connection.ConnectionURL)2 After (org.junit.After)2 BufferedInputStream (java.io.BufferedInputStream)1 BufferedOutputStream (java.io.BufferedOutputStream)1