Search in sources :

Example 1 with DockerExplorerView

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView in project linuxtools by eclipse.

the class AbstractDockerBotTest method createConnection.

/**
 * Creates a connection with the settings in this test. Stores it in
 * instance variable {@link #connection}.
 *
 * @returns the connection that was creates
 *
 * @see #SYSPROP_DOCKER_MACHINE_NAME
 * @see #SYSPROP_DOCKER_SERVER_URI
 * @see #SYSPROP_UNIX_SOCKET
 */
protected DockerConnection createConnection() {
    DockerExplorerView dockerView = new DockerExplorerView();
    dockerView.open();
    String dockerMachineName = System.getProperty(SYSPROP_DOCKER_MACHINE_NAME);
    String dockerServerURI = System.getProperty(SYSPROP_DOCKER_SERVER_URI);
    String unixSocket = System.getProperty(SYSPROP_UNIX_SOCKET);
    String mockito = System.getProperty(SYSPROP_MOCKITO);
    if (!StringUtils.isBlank(dockerMachineName)) {
        dockerView.createDockerConnectionSearch(dockerMachineName);
        this.connection = getConnectionByName(dockerMachineName);
    } else if (!StringUtils.isEmpty(dockerServerURI)) {
        dockerView.createDockerConnection(AuthenticationMethod.TCP_CONNECTION, dockerServerURI, null, dockerServerURI);
        this.connection = getConnectionByHost(dockerServerURI);
    } else if (!StringUtils.isEmpty(unixSocket)) {
        dockerView.createDockerConnection(AuthenticationMethod.UNIX_SOCKET, unixSocket, null, unixSocket);
        this.connection = getConnectionByHost(unixSocket);
    } else if ("true".equals(mockito)) {
        MockUtils.createDockerMockConnection(DEFAULT_CONNECTION_NAME);
        this.connection = getConnectionByName(DEFAULT_CONNECTION_NAME);
    } else {
        fail("Cannot create a docker connection. " + "Neither " + SYSPROP_DOCKER_MACHINE_NAME + " nor " + SYSPROP_DOCKER_SERVER_URI + " nor " + SYSPROP_UNIX_SOCKET + " were defined nor, " + SYSPROP_MOCKITO + " was enabled.");
    }
    // can't be null, fails before
    connection.enableConnection();
    return connection;
}
Also used : DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)

Example 2 with DockerExplorerView

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView in project linuxtools by eclipse.

the class MockUtils method configureUnixSocketConnection.

private static IDockerConnection configureUnixSocketConnection(final String connectionName, final String pathToSocket) {
    DockerClient client = MockDockerClientFactory.build();
    final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory.from(connectionName, client).withUnixSocketConnectionSettings(pathToSocket);
    DockerExplorerView de = new DockerExplorerView();
    de.open();
    de.createDockerConnectionUnix(dockerConnection);
    MockDockerConnectionManager.configureConnectionManager(dockerConnection);
    return dockerConnection;
}
Also used : DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) DockerClient(com.spotify.docker.client.DockerClient)

Example 3 with DockerExplorerView

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView in project linuxtools by eclipse.

the class SearchDialogTest method testSearchDialog.

@Test
public void testSearchDialog() {
    DockerExplorerView explorer = new DockerExplorerView();
    getConnection().openImageSearchDialog(IMAGE_NAME, null, REGISTRY_URL);
    ImageSearchPage pageOne = new ImageSearchPage(explorer);
    pageOne.searchImage();
    assertFalse("Search result is empty!", pageOne.getSearchResults().isEmpty());
    assertTrue("Search result do not contains image:" + EXPECTED_IMAGE_NAME + "!", pageOne.searchResultsContains(EXPECTED_IMAGE_NAME));
    pageOne.next();
    // new WaitUntil(new ShellIsAvailable("Progress Information"), TimePeriod.DEFAULT);
    AbstractWait.sleep(TimePeriod.getCustom(5));
    ImageTagSelectionPage pageTwo = new ImageTagSelectionPage(pageOne);
    assertFalse("Search tags are empty!", pageTwo.getTags().isEmpty());
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    if (!pageTwo.tagsContains(IMAGE_TAG)) {
        pageTwo.cancel();
        new CancelButton().click();
        fail("Search results do not contain tag: " + IMAGE_TAG + "!");
    }
    pageTwo.selectTag(IMAGE_TAG);
    pageTwo.finish();
    new PushButton("Finish").click();
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
}
Also used : DockerExplorerView(org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView) ImageSearchPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageSearchPage) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ImageTagSelectionPage(org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageTagSelectionPage) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) Test(org.junit.Test) AbstractImageBotTest(org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)

Example 4 with DockerExplorerView

use of org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView 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 5 with DockerExplorerView

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

Aggregations

DockerExplorerView (org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView)14 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)6 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)6 DockerConnection (org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection)4 ImageRunSelectionPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage)3 Test (org.junit.Test)3 AbstractImageBotTest (org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)2 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)2 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)2 Before (org.junit.Before)2 DockerClient (com.spotify.docker.client.DockerClient)1 File (java.io.File)1 IOException (java.io.IOException)1 ContainerIsDeployedCondition (org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition)1 ImageRunResourceVolumesVariablesPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage)1 ImageSearchPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageSearchPage)1 ImageTagSelectionPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageTagSelectionPage)1 DockerContainersTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab)1 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)1