Search in sources :

Example 1 with DockerConnection

use of org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection in project jbosstools-openshift by jbosstools.

the class DeployDockerImageTest method createDockerConnection.

public static void createDockerConnection() {
    dockerExplorer = new DockerExplorerView();
    dockerExplorer.open();
    List<String> connectionsNames = dockerExplorer.getDockerConnectionNames();
    if (!connectionsNames.isEmpty()) {
        for (String connectionName : connectionsNames) {
            DockerConnection dockerConnection = dockerExplorer.getDockerConnectionByName(connectionName);
            if (dockerConnection != null) {
                dockerConnection.removeConnection();
            }
        }
    }
    dockerExplorer.createDockerConnectionURI(connectionsURI, connectionsURI, pathToCertificate);
}
Also used : DockerConnection(org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)

Example 2 with DockerConnection

use of org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection in project jbosstools-openshift by jbosstools.

the class DeployDockerImageTest method debugDockerImageTest.

/**
 * Auxiliary method for helping with debugging JBIDE-23841.
 * This method maximizes Docker explorer view, captures screenshot and restores the view back.
 * It also gathers some info and returns it.
 */
private static String debugDockerImageTest() {
    String message = "";
    DockerExplorerView dockerExplorerView = new DockerExplorerView();
    dockerExplorerView.maximize();
    try {
        ScreenshotCapturer.getInstance().captureScreenshot("DeployDockerImageTest#setup");
    } catch (CaptureScreenshotException e) {
        // Capturing screenshot was not successfull. No big deal.
        LOGGER.debug("Capturing screenshot was not succesfull.");
    }
    dockerExplorerView.restore();
    List<String> names = dockerExplorerView.getDockerConnectionNames();
    for (String name : names) {
        DockerConnection connection = dockerExplorerView.getDockerConnectionByName(name);
        TreeItem treeItem = connection.getTreeItem();
        message += "TreeItem for connection \"" + name + "\": " + treeItem.getText() + "\n";
    }
    return message;
}
Also used : DockerConnection(org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection) DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)

Example 3 with DockerConnection

use of org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection 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)

Example 4 with DockerConnection

use of org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection in project jbosstools-openshift by jbosstools.

the class DeployDockerImageTest method pullHelloImageIfDoesNotExist.

/**
 * If hello world docker image does not exist, this method will pull it.
 */
private static void pullHelloImageIfDoesNotExist() {
    DockerExplorerView dockerExplorer = new DockerExplorerView();
    DockerConnection dockerConnection = dockerExplorer.getDockerConnectionByName(DOCKER_CONNECTION);
    dockerConnection.getTreeItem().expand();
    new WaitWhile(new JobIsRunning());
    new WaitWhile(new TreeContainsItem(dockerConnection.getTreeItem().getParent(), dockerConnection.getTreeItem().getText(), "Loading..."), TimePeriod.LONG);
    if (dockerConnection.getImage(HELLO_OS_DOCKER_IMAGE, TAG) == null) {
        dockerConnection.pullImage(HELLO_OS_DOCKER_IMAGE, TAG);
    }
}
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) TreeContainsItem(org.eclipse.reddeer.swt.condition.TreeContainsItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Aggregations

DockerExplorerView (org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)4 DockerConnection (org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection)4 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 JFaceLayerException (org.eclipse.reddeer.jface.exception.JFaceLayerException)1 CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 TreeContainsItem (org.eclipse.reddeer.swt.condition.TreeContainsItem)1 SystemJobIsRunning (org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning)1