Search in sources :

Example 1 with JFaceLayerException

use of org.eclipse.reddeer.jface.exception.JFaceLayerException in project jbosstools-openshift by jbosstools.

the class CDKTestUtils method removeAccessRedHatCredentials.

// removes access redhat com credentials used for first cdk run
public static void removeAccessRedHatCredentials(String domain, String username) {
    WorkbenchPreferenceDialog dialog = new WorkbenchPreferenceDialog();
    dialog.open();
    // $NON-NLS-1$ //$NON-NLS-2$
    dialog.select("JBoss Tools", "Credentials");
    try {
        new WaitUntil(new WidgetIsFound(org.eclipse.swt.custom.CLabel.class, new WithMnemonicTextMatcher("Credentials")), // $NON-NLS-1$
        TimePeriod.MEDIUM);
        // $NON-NLS-1$
        new DefaultCLabel("Credentials");
        DefaultTree tree = new DefaultTree(1);
        TreeItem item = TreeViewerHandler.getInstance().getTreeItem(tree, new String[] { domain, username });
        item.select();
        // $NON-NLS-1$
        new PushButton(new WithTextMatcher("Remove User")).click();
        new WaitUntil(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (WaitTimeoutExpiredException exc) {
        // $NON-NLS-1$
        log.error("JBoss Tools - Credentials preferences page has timed out");
        exc.printStackTrace();
    } catch (JFaceLayerException exc) {
        // $NON-NLS-1$
        log.error("JBoss Tools - Credentials does not contain required username to be deleted");
        exc.printStackTrace();
    } finally {
        dialog.ok();
    }
}
Also used : DefaultCLabel(org.eclipse.reddeer.swt.impl.clabel.DefaultCLabel) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) JFaceLayerException(org.eclipse.reddeer.jface.exception.JFaceLayerException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) DefaultCLabel(org.eclipse.reddeer.swt.impl.clabel.DefaultCLabel) WithMnemonicTextMatcher(org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher) WidgetIsFound(org.eclipse.reddeer.core.condition.WidgetIsFound) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) WorkbenchPreferenceDialog(org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 2 with JFaceLayerException

use of org.eclipse.reddeer.jface.exception.JFaceLayerException in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method testDockerConnection.

/**
 * Tests Docker connection
 *
 * @param dockerDaemon name of docker connection
 */
public void testDockerConnection(String dockerDaemon) {
    DockerExplorerView dockerExplorer = new DockerExplorerView();
    dockerExplorer.open();
    DockerConnection connection = dockerExplorer.getDockerConnectionByName(dockerDaemon);
    if (connection == null) {
        // $NON-NLS-1$
        fail("Could not find Docker connection " + dockerDaemon);
    }
    connection.select();
    connection.enableConnection();
    connection.refresh();
    new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
    try {
        // $NON-NLS-1$
        assertTrue("Docker connection does not contain any images", connection.getImagesNames().size() > 0);
    } catch (WaitTimeoutExpiredException ex) {
        ex.printStackTrace();
        fail(// $NON-NLS-1$
        "WaitTimeoutExpiredException occurs when expanding" + " Docker connection " + // $NON-NLS-1$
        dockerDaemon);
    } catch (JFaceLayerException jFaceExc) {
        jFaceExc.printStackTrace();
        fail(jFaceExc.getMessage());
    }
    dockerExplorer.close();
}
Also used : DockerConnection(org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JFaceLayerException(org.eclipse.reddeer.jface.exception.JFaceLayerException) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Aggregations

WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 JFaceLayerException (org.eclipse.reddeer.jface.exception.JFaceLayerException)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 DockerExplorerView (org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)1 DockerConnection (org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)1 WidgetIsFound (org.eclipse.reddeer.core.condition.WidgetIsFound)1 WithMnemonicTextMatcher (org.eclipse.reddeer.core.matcher.WithMnemonicTextMatcher)1 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)1 DefaultCLabel (org.eclipse.reddeer.swt.impl.clabel.DefaultCLabel)1 DefaultTree (org.eclipse.reddeer.swt.impl.tree.DefaultTree)1 WorkbenchPreferenceDialog (org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog)1 SystemJobIsRunning (org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning)1