Bug 510754 - Integration tests for Docker Tooling (+ Mockito)
Signed-off-by: Josef Kopriva <jkopriva@redhat.com>
Change-Id: Ie99aaf281628102126784900b3215eb5f5b611c6
Reviewed-on: https://git.eclipse.org/r/89418
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
diff --git a/containers/org.eclipse.linuxtools.docker.core/META-INF/MANIFEST.MF b/containers/org.eclipse.linuxtools.docker.core/META-INF/MANIFEST.MF
index 327ce16..1547060 100644
--- a/containers/org.eclipse.linuxtools.docker.core/META-INF/MANIFEST.MF
+++ b/containers/org.eclipse.linuxtools.docker.core/META-INF/MANIFEST.MF
@@ -23,6 +23,6 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.linuxtools.docker.core,
- org.eclipse.linuxtools.internal.docker.core;x-friends:="org.eclipse.linuxtools.docker.ui,org.eclipse.linuxtools.docker.ui.tests"
+ org.eclipse.linuxtools.internal.docker.core;x-friends:="org.eclipse.linuxtools.docker.ui,org.eclipse.linuxtools.docker.ui.tests,org.eclipse.linuxtools.docker.integration.tests"
Import-Package: com.fasterxml.jackson.annotation;version="2.5.0"
Bundle-ClassPath: .
diff --git a/containers/org.eclipse.linuxtools.docker.docs/.settings/org.eclipse.m2e.core.prefs b/containers/org.eclipse.linuxtools.docker.docs/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.docs/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/containers/org.eclipse.linuxtools.docker.editor/.settings/org.eclipse.m2e.core.prefs b/containers/org.eclipse.linuxtools.docker.editor/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.editor/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/.classpath b/containers/org.eclipse.linuxtools.docker.integration.tests/.classpath
new file mode 100644
index 0000000..cf36b56
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/.project b/containers/org.eclipse.linuxtools.docker.integration.tests/.project
new file mode 100644
index 0000000..20992a6
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.docker.integration.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.core.resources.prefs b/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.jdt.core.prefs b/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.m2e.core.prefs b/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/META-INF/MANIFEST.MF b/containers/org.eclipse.linuxtools.docker.integration.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..e72394b
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,42 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.linuxtools.docker.integration.tests;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: %providerName
+Require-Bundle: org.junit,
+ org.eclipse.linuxtools.docker.ui;bundle-version="2.1.0",
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.linuxtools.docker.reddeer;bundle-version="1.0.0",
+ org.jboss.reddeer.junit.extension;bundle-version="1.2.1",
+ org.jboss.reddeer.common;bundle-version="1.2.1",
+ org.jboss.reddeer.core;bundle-version="1.2.1",
+ org.jboss.reddeer.eclipse;bundle-version="1.2.1",
+ org.jboss.reddeer.core;bundle-version="1.2.1",
+ org.jboss.reddeer.swt;bundle-version="1.2.1",
+ org.jboss.reddeer.junit;bundle-version="1.2.1",
+ org.jboss.reddeer.requirements;bundle-version="1.2.1",
+ org.jboss.reddeer.workbench;bundle-version="1.2.1",
+ org.apache.commons.io,
+ org.apache.commons.lang,
+ org.eclipse.linuxtools.docker.core,
+ org.mockito,
+ com.spotify.docker.client;bundle-version="3.6.8",
+ org.eclipse.linuxtools.docker.ui.tests,
+ org.eclipse.ui.console
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.debug.core,
+ org.eclipse.linuxtools.docker.reddeer,
+ org.eclipse.linuxtools.docker.reddeer.condition,
+ org.eclipse.linuxtools.docker.reddeer.core.ui.wizards,
+ org.eclipse.linuxtools.docker.reddeer.perspective,
+ org.eclipse.linuxtools.docker.reddeer.preferences,
+ org.eclipse.linuxtools.docker.reddeer.ui,
+ org.eclipse.linuxtools.docker.reddeer.ui.resources,
+ org.eclipse.linuxtools.docker.reddeer.utils,
+ org.hamcrest;version="1.3.0"
+
+
+
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/README b/containers/org.eclipse.linuxtools.docker.integration.tests/README
new file mode 100644
index 0000000..a58f4d2
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/README
@@ -0,0 +1,96 @@
+Running in Eclipse
+------------------
+* Launch configuration:
+ ** use a Red Deer launcher
+ ** "Red Deer" Tab:
+ rd.closeWelcomeScreen = true
+ ** "Arguments" Tab:
+ -Dusage_reporting_enabled=false
+ -DdockerServerURI=
+ -DunixSocket=unix:///var/run/docker.sock
+ -DdockerMachineName=
+ -DdockerHubUsername=<username>
+ -DdockerHubEmail=<email>
+ -DdockerHubPassword=<password>
+ -DdockerComposePath=/usr/bin
+ -DskipTests=false
+
+Running in Command Line
+-----------------------
+mvn clean verify
+-Dusage_reporting_enabled=false \
+-DdockerServerURI= \
+-DunixSocket=unix:///var/run/docker.sock \
+-DdockerMachineName=
+-DdockerHubUsername=<username> \
+-DdockerHubEmail=<email> \
+-DdockerHubPassword=<password> \
+-DskipTests=false
+-DdockerComposePath=/usr/bin
+
+Parameters:
+-----------
+
+dockerMockito
+-------------
+Mock docker - to run tests without installed Docker daemon. Its by default set to true.
+If should be set to false (e.g. "-DdockerMockito=false"), when tests are run with Docker daemon.
+
+dockerServerURI*
+---------------
+Docker server uri (e.g. "tcp://localhost:2375"). Typically used in Windows.
+
+dockerMachineName
+-----------------
+The docker-machine name that the tests should use to connect to (e.g. "default").
+
+dockerHubUsername
+-----------------
+Username for the Docker hub account.
+
+dockerHubEmail
+--------------
+Email for the Docker hub account.
+
+dockerHubPassword
+-----------------
+Password for the Docker hub account.
+
+dockerComposePath
+-----------------
+Path to Docker Compose (e.g. "/usr/bin").
+
+
+How to run tests
+----------------
+Integration tests for Docker Tooling can be run with Mockito or with Docker Daemon.
+When running with Docker daemon, user should specify only one connection type: Unix socket or Docker server URI or Docker machine name.
+When running with Docker daemon, user should also have correctly setup Docker daemon.
+
+Running tests with Mockito (by default)
+---------------------------------------
+User can use just basic maven command: "mvn clean verify".
+Docker Daemon is mocked.
+
+Running tests with Docker Daemon
+--------------------------------
+You can also use Docker daemon to run tests. In this case, you can specify whether you are using a Unix socket, TCP connection, or Docker Machine.
+Do not forget to set Mockito to false be adding "-DdockerMockito=false" in command.
+
+Running tests with Unix Socket
+------------------------------
+Docker server Unix socket (e.r. "unix:///var/run/docker.sock"). Typically used in Linux or MacOS (on Windows use dockerServerURI).
+Example: "mvn clean verify -DunixSocket=unix:///var/run/docker.sock -DdockerMockito=false -DdockerHubUsername=user -DdockerHubEmail=user@server.com -DdockerHubPassword=password -DdockerComposePath=/path/to/docker/compose"
+
+Running tests with Docker Server URI
+------------------------------------
+Docker server uri (e.g. "tcp://localhost:2375"). Typically used in Windows.
+Example: "mvn clean verify -DdockerServerURI=tcp://localhost:2375 -DdockerMockito=false -DdockerHubUsername=user -DdockerHubEmail=user@server.com -DdockerHubPassword=password -DdockerComposePath=/path/to/docker/compose"
+
+Running tests with Docker Machine
+---------------------------------
+The docker-machine name that the tests should use to connect to (e.g. "default").
+This only works if you have docker-machine set up and running.
+Example: "mvn clean verify -DdockerMachineName=default -DdockerMockito=false -DdockerHubUsername=user -DdockerHubEmail=user@server.com -DdockerHubPassword=password -DdockerComposePath=/path/to/docker/compose"
+
+
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/about.html b/containers/org.eclipse.linuxtools.docker.integration.tests/about.html
new file mode 100644
index 0000000..d93dcd5
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>April 5, 2017</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/build.properties b/containers/org.eclipse.linuxtools.docker.integration.tests/build.properties
new file mode 100644
index 0000000..72b6b36
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/build.properties
@@ -0,0 +1,3 @@
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/launchers/DockerAllBotTest Mockito.launch b/containers/org.eclipse.linuxtools.docker.integration.tests/launchers/DockerAllBotTest Mockito.launch
new file mode 100644
index 0000000..45d52ff
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/launchers/DockerAllBotTest Mockito.launch
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.jboss.reddeer.eclipse.ui.launcher.JunitLaunchConfig">
+<setAttribute key="additional_plugins">
+<setEntry value="com.spotify.docker.client:3.6.8.v20161117-2005:default:true"/>
+<setEntry value="org.apache.httpcomponents.httpclient:4.5.2.v20161115-1643:default:true"/>
+<setEntry value="org.apache.httpcomponents.httpcore:4.4.4.v20161115-1643:default:true"/>
+<setEntry value="org.eclipse.linuxtools.docker.core:2.3.0.qualifier:default:true"/>
+<setEntry value="org.eclipse.linuxtools.docker.editor:1.0.0.qualifier:default:true"/>
+<setEntry value="org.eclipse.linuxtools.docker.integration.tests:1.0.0.qualifier:default:true"/>
+<setEntry value="org.eclipse.linuxtools.docker.reddeer:1.0.0.qualifier:default:true"/>
+<setEntry value="org.eclipse.linuxtools.docker.tests.hamcrest-wrap:1.2.0.qualifier:default:true"/>
+<setEntry value="org.eclipse.linuxtools.docker.ui.tests:2.1.0.qualifier:default:true"/>
+<setEntry value="org.eclipse.linuxtools.docker.ui:2.3.0.qualifier:default:true"/>
+<setEntry value="org.slf4j.api:1.7.10.v20160921-1923:default:true"/>
+</setAttribute>
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="true"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="false"/>
+<stringAttribute key="featureDefaultLocation" value="workspace"/>
+<stringAttribute key="featurePluginResolution" value="workspace"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/DockerAllBotTest.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DISPLAY" value=":1"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.linuxtools.docker.integration.tests.DockerAllBotTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -consolelog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.linuxtools.docker.integration.tests"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dmockito=Mock -Dusage_reporting_enabled=false -DdockerHubUsername=test -DdockerHubEmail=test@test.com -DdockerHubPassword=password -DdockerComposePath=//testpath"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<stringAttribute key="rd.launch.property.rd.captureScreenshot" value="true"/>
+<stringAttribute key="rd.launch.property.rd.closeShells" value="true"/>
+<stringAttribute key="rd.launch.property.rd.closeWelcomeScreen" value="true"/>
+<stringAttribute key="rd.launch.property.rd.disableMavenIndex" value="true"/>
+<stringAttribute key="rd.launch.property.rd.logCollectorEnabled" value="true"/>
+<stringAttribute key="rd.launch.property.rd.logLevel" value="ALL"/>
+<stringAttribute key="rd.launch.property.rd.logMessageFilter" value="ALL"/>
+<stringAttribute key="rd.launch.property.rd.openAssociatedPerspective" value="never"/>
+<stringAttribute key="rd.launch.property.rd.pauseFailedTest" value="false"/>
+<stringAttribute key="rd.launch.property.rd.timePeriodFactor" value="1.0"/>
+<setAttribute key="selected_features">
+<setEntry value="org.eclipse.cdt.autotools:default"/>
+<setEntry value="org.eclipse.cdt.gdb:default"/>
+<setEntry value="org.eclipse.cdt.gnu.build:default"/>
+<setEntry value="org.eclipse.cdt.gnu.debug:default"/>
+<setEntry value="org.eclipse.cdt.gnu.dsf:default"/>
+<setEntry value="org.eclipse.cdt.native:default"/>
+<setEntry value="org.eclipse.cdt.platform:default"/>
+<setEntry value="org.eclipse.cdt:default"/>
+<setEntry value="org.eclipse.draw2d:default"/>
+<setEntry value="org.eclipse.e4.rcp:default"/>
+<setEntry value="org.eclipse.ecf.core.feature:default"/>
+<setEntry value="org.eclipse.ecf.core.ssl.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.ssl.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.ssl.feature:default"/>
+<setEntry value="org.eclipse.emf.common:default"/>
+<setEntry value="org.eclipse.emf.ecore:default"/>
+<setEntry value="org.eclipse.equinox.p2.core.feature:default"/>
+<setEntry value="org.eclipse.equinox.p2.extras.feature:default"/>
+<setEntry value="org.eclipse.equinox.p2.rcp.feature:default"/>
+<setEntry value="org.eclipse.equinox.p2.user.ui:default"/>
+<setEntry value="org.eclipse.help:default"/>
+<setEntry value="org.eclipse.jgit:default"/>
+<setEntry value="org.eclipse.launchbar:default"/>
+<setEntry value="org.eclipse.license:default"/>
+<setEntry value="org.eclipse.linuxtools.docker.feature:default"/>
+<setEntry value="org.eclipse.platform:default"/>
+<setEntry value="org.eclipse.ptp.rdt.sync:default"/>
+<setEntry value="org.eclipse.rcp:default"/>
+<setEntry value="org.eclipse.remote:default"/>
+<setEntry value="org.eclipse.swtbot.eclipse:default"/>
+<setEntry value="org.eclipse.swtbot.forms:default"/>
+<setEntry value="org.eclipse.swtbot:default"/>
+<setEntry value="org.eclipse.tm.terminal.connector.local.feature:default"/>
+<setEntry value="org.eclipse.tm.terminal.connector.serial.feature:default"/>
+<setEntry value="org.eclipse.tm.terminal.connector.ssh.feature:default"/>
+<setEntry value="org.eclipse.tm.terminal.connector.telnet.feature:default"/>
+<setEntry value="org.eclipse.tm.terminal.control.feature:default"/>
+<setEntry value="org.eclipse.tm.terminal.feature:default"/>
+<setEntry value="org.eclipse.tm.terminal.view.feature:default"/>
+<setEntry value="org.eclipse.zest:default"/>
+<setEntry value="org.jboss.reddeer.eclipse.feature:default"/>
+<setEntry value="org.jboss.reddeer.junit.extension.feature:default"/>
+<setEntry value="org.jboss.reddeer.ui.feature:default"/>
+</setAttribute>
+<stringAttribute key="selected_target_plugins" value="com.fasterxml.jackson.core.jackson-annotations@default:default,com.fasterxml.jackson.core.jackson-core@default:default,com.fasterxml.jackson.core.jackson-databind@default:default,com.fasterxml.jackson.datatype.jackson-datatype-guava@default:default,com.fasterxml.jackson.jaxrs.jackson-jaxrs-base@default:default,com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider@default:default,com.github.jnr.constants@default:default,com.github.jnr.enxio@default:default,com.github.jnr.ffi@default:default,com.github.jnr.jffi.native@default:false,com.github.jnr.jffi@default:default,com.github.jnr.posix@default:default,com.github.jnr.unixsocket@default:default,com.google.gson@default:default,com.google.guava@default:default,com.ibm.icu@default:default,com.jcraft.jsch@default:default,com.spotify.docker.client@default:true,com.sun.el@default:default,javaewah@default:default,javassist@default:default,javax.annotation@default:default,javax.el@default:default,javax.inject@default:default,javax.servlet.jsp@default:default,javax.servlet@default:default,javax.ws.rs@default:default,javax.xml@default:default,jnr.x86asm@default:default,org.aopalliance@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.beanutils@default:default,org.apache.commons.codec@default:default,org.apache.commons.compress@default:default,org.apache.commons.io@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.lang3.source@default:default,org.apache.commons.lang3@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.apache.httpcomponents.httpclient*4.3.6.v201511171540@default:default,org.apache.httpcomponents.httpclient*4.5.2.v20161115-1643@default:default,org.apache.httpcomponents.httpcore*4.3.3.v201411290715@default:default,org.apache.httpcomponents.httpcore*4.4.4.v20161115-1643@default:default,org.apache.jasper.glassfish@default:default,org.apache.log4j@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.assertj@default:default,org.bouncycastle.bcpkix@default:default,org.bouncycastle.bcprov@default:default,org.cyberneko.html@default:default,org.eclipse.ant.core@default:default,org.eclipse.ant.launching@default:default,org.eclipse.ant.ui@default:default,org.eclipse.cdt.autotools.core@default:default,org.eclipse.cdt.autotools.docs@default:default,org.eclipse.cdt.autotools.ui@default:default,org.eclipse.cdt.build.gcc.core@default:default,org.eclipse.cdt.codan.checkers.ui@default:default,org.eclipse.cdt.codan.checkers@default:default,org.eclipse.cdt.codan.core.cxx@default:default,org.eclipse.cdt.codan.core@default:default,org.eclipse.cdt.codan.ui.cxx@default:default,org.eclipse.cdt.codan.ui@default:default,org.eclipse.cdt.core.linux.x86_64@default:false,org.eclipse.cdt.core.linux@default:false,org.eclipse.cdt.core.native@default:default,org.eclipse.cdt.core@default:default,org.eclipse.cdt.debug.core@default:default,org.eclipse.cdt.debug.ui@default:default,org.eclipse.cdt.doc.user@default:default,org.eclipse.cdt.dsf.gdb.ui@default:default,org.eclipse.cdt.dsf.gdb@default:default,org.eclipse.cdt.dsf.ui@default:default,org.eclipse.cdt.dsf@default:default,org.eclipse.cdt.gdb.ui@default:default,org.eclipse.cdt.gdb@default:default,org.eclipse.cdt.launch@default:default,org.eclipse.cdt.make.core@default:default,org.eclipse.cdt.make.ui@default:default,org.eclipse.cdt.managedbuilder.core@default:default,org.eclipse.cdt.managedbuilder.gnu.ui@default:default,org.eclipse.cdt.managedbuilder.ui@default:default,org.eclipse.cdt.native.serial@default:default,org.eclipse.cdt.remote.core@default:default,org.eclipse.cdt.ui@default:default,org.eclipse.cdt@default:default,org.eclipse.compare.core@default:default,org.eclipse.compare@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.externaltools@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.debug.core@default:default,org.eclipse.debug.ui@default:default,org.eclipse.draw2d@default:default,org.eclipse.dstore.core@default:default,org.eclipse.dstore.extra@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.dialogs@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.swt.gtk@default:false,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer.httpclient4.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient4@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.equinox.launcher.gtk.linux.x86_64@default:false,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.director.app@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.directorywatcher@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.extensionlocation@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.operations@default:default,org.eclipse.equinox.p2.publisher.eclipse@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.reconciler.dropins@default:default,org.eclipse.equinox.p2.repository.tools@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.p2.transport.ecf@default:default,org.eclipse.equinox.p2.ui.importexport@default:default,org.eclipse.equinox.p2.ui.sdk.scheduler@default:default,org.eclipse.equinox.p2.ui.sdk@default:default,org.eclipse.equinox.p2.ui@default:default,org.eclipse.equinox.p2.updatechecker@default:default,org.eclipse.equinox.p2.updatesite@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.util@default:default,org.eclipse.gef@default:default,org.eclipse.help.base@default:default,org.eclipse.help.ui@default:default,org.eclipse.help.webapp@default:default,org.eclipse.help@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.jdt.core@default:default,org.eclipse.jdt.debug.ui@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.jdt.junit.core@default:default,org.eclipse.jdt.junit.runtime@default:default,org.eclipse.jdt.junit@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.jgit.archive@default:default,org.eclipse.jgit@default:default,org.eclipse.jsch.core@default:default,org.eclipse.jsch.ui@default:default,org.eclipse.launchbar.core@default:default,org.eclipse.launchbar.ui.controls@default:default,org.eclipse.launchbar.ui@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.eclipse.pde.build@default:default,org.eclipse.pde.core@default:default,org.eclipse.pde.launching@default:default,org.eclipse.pde.runtime@default:default,org.eclipse.pde.ui@default:default,org.eclipse.platform.doc.user@default:default,org.eclipse.platform@default:default,org.eclipse.ptp.rdt.sync.core@default:default,org.eclipse.ptp.rdt.sync.git.core@default:default,org.eclipse.ptp.rdt.sync.git.ui@default:default,org.eclipse.ptp.rdt.sync.ui@default:default,org.eclipse.rcp@default:default,org.eclipse.remote.console@default:default,org.eclipse.remote.core@default:default,org.eclipse.remote.doc.isv@default:default,org.eclipse.remote.jsch.core@default:default,org.eclipse.remote.jsch.ui@default:default,org.eclipse.remote.serial.core@default:default,org.eclipse.remote.serial.ui@default:default,org.eclipse.remote.telnet.core@default:default,org.eclipse.remote.telnet.ui@default:default,org.eclipse.remote.ui@default:default,org.eclipse.search@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.swtbot.e4.finder@default:default,org.eclipse.swtbot.eclipse.core@default:default,org.eclipse.swtbot.eclipse.finder@default:default,org.eclipse.swtbot.forms.finder@default:default,org.eclipse.swtbot.go@default:default,org.eclipse.swtbot.junit4_x@default:default,org.eclipse.swtbot.swt.finder@default:default,org.eclipse.team.core@default:default,org.eclipse.team.ui@default:default,org.eclipse.text@default:default,org.eclipse.tm.terminal.connector.local@default:default,org.eclipse.tm.terminal.connector.process@default:default,org.eclipse.tm.terminal.connector.serial@default:default,org.eclipse.tm.terminal.connector.ssh@default:default,org.eclipse.tm.terminal.connector.telnet@default:default,org.eclipse.tm.terminal.control@default:default,org.eclipse.tm.terminal.view.core@default:default,org.eclipse.tm.terminal.view.ui@default:default,org.eclipse.tools.templates.core@default:default,org.eclipse.tools.templates.ui@default:default,org.eclipse.ui.browser@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.console@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.externaltools@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro.quicklinks@default:default,org.eclipse.ui.intro.universal@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.monitoring@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.net@default:default,org.eclipse.ui.themes@default:default,org.eclipse.ui.trace@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.eclipse.update.configurator@3:true,org.eclipse.wb.core.lib@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.wst.internet.monitor.core@default:default,org.eclipse.wst.server.core@default:default,org.eclipse.wst.server.discovery@default:default,org.eclipse.wst.server.ui@default:default,org.eclipse.zest.core@default:default,org.eclipse.zest.layouts@default:default,org.glassfish.hk2.api@default:default,org.glassfish.hk2.locator@default:default,org.glassfish.hk2.osgi-resource-locator@default:default,org.glassfish.hk2.utils@default:default,org.glassfish.jersey.apache.connector@default:default,org.glassfish.jersey.bundles.repackaged.jersey-guava@default:default,org.glassfish.jersey.core.jersey-client@default:default,org.glassfish.jersey.core.jersey-common@default:default,org.glassfish.jersey.core.jersey-server@default:default,org.glassfish.jersey.ext.entityfiltering@default:default,org.glassfish.jersey.media.jersey-media-json-jackson@default:default,org.hamcrest.core@default:default,org.hamcrest.library@default:default,org.jboss.reddeer.common@default:default,org.jboss.reddeer.core@default:default,org.jboss.reddeer.direct@default:default,org.jboss.reddeer.eclipse@default:default,org.jboss.reddeer.gef@default:default,org.jboss.reddeer.go@default:default,org.jboss.reddeer.jface@default:default,org.jboss.reddeer.junit.extension@default:default,org.jboss.reddeer.junit@default:default,org.jboss.reddeer.requirements@default:default,org.jboss.reddeer.swt@default:default,org.jboss.reddeer.ui@default:default,org.jboss.reddeer.uiforms@default:default,org.jboss.reddeer.workbench@default:default,org.junit@default:default,org.mockito@default:default,org.objectweb.asm.analysis@default:default,org.objectweb.asm.tree@default:default,org.objectweb.asm.util@default:default,org.objectweb.asm@default:default,org.objenesis@default:default,org.sat4j.core@default:default,org.sat4j.pb@default:default,org.slf4j.api*1.7.10.v20160921-1923@default:default,org.slf4j.api*1.7.2.v20121108-1250@default:default,org.slf4j.impl.log4j12@default:false,org.swtchart@default:default,org.tukaani.xz@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.linuxtools.docker.core@default:default,org.eclipse.linuxtools.docker.docs@default:default,org.eclipse.linuxtools.docker.editor@default:default,org.eclipse.linuxtools.docker.integration.tests@default:default,org.eclipse.linuxtools.docker.reddeer@default:default,org.eclipse.linuxtools.docker.tests.hamcrest-wrap@default:default,org.eclipse.linuxtools.docker.ui.tests@default:default,org.eclipse.linuxtools.docker.ui@default:default"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="true"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+</launchConfiguration>
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/pom.xml b/containers/org.eclipse.linuxtools.docker.integration.tests/pom.xml
new file mode 100644
index 0000000..15b391e
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/pom.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.linuxtools</groupId>
+ <artifactId>org.eclipse.linuxtools.docker</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.linuxtools.docker.integration.tests</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <properties>
+ <systemProperties>-DsearchConnection=${searchConnection} -DdockerServerURI=${dockerServerURI} -DunixSocket=${unixSocket} -DdockerHubUsername=${dockerHubUsername} -DdockerHubEmail=${dockerHubEmail} -DdockerHubPassword=${dockerHubPassword} -DdockerComposePath=${dockerComposePath} -DdockerMockito=${dockerMockito}</systemProperties>
+ <searchConnection></searchConnection>
+ <unixSocket></unixSocket>
+ <dockerServerURI></dockerServerURI>
+ <dockerHubUsername></dockerHubUsername>
+ <dockerHubEmail></dockerHubEmail>
+ <dockerHubPassword></dockerHubPassword>
+ <dockerComposePath></dockerComposePath>
+ <dockerMockito>true</dockerMockito>
+ <tycho.test.jvmArgs>-Xmx800m</tycho.test.jvmArgs>
+ <tycho.surefire.timeout>1800</tycho.surefire.timeout>
+ </properties>
+
+
+ <profiles>
+ <profile>
+ <id>ignore-mac-deps-on-other-os</id>
+ <activation>
+ <os>
+ <family>!mac</family>
+ </os>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <configuration>
+ <dependency-resolution>
+ <optionalDependencies>ignore</optionalDependencies>
+ </dependency-resolution>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-compiler-plugin</artifactId>
+ <configuration>
+ <optionalDependencies>ignore</optionalDependencies>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <useUIThread>false</useUIThread>
+ <forkedProcessTimeoutInSeconds>${tycho.surefire.timeout}</forkedProcessTimeoutInSeconds>
+ <argLine>${tycho.test.jvmArgs} ${systemProperties}</argLine>
+ <testClass>org.eclipse.linuxtools.docker.integration.tests.DockerAllBotTest</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>mac</id>
+ <activation>
+ <os>
+ <family>mac</family>
+ </os>
+ </activation>
+ <properties>
+ <!-- Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=388084 -->
+ <!-- THE FOLLOWING LINE MUST NOT BE BROKEN BY AUTOFORMATTING -->
+ <tycho.test.jvmArgs>-Xmx800m -XstartOnFirstThread</tycho.test.jvmArgs>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <configuration>
+ <environments>
+ <environment>
+ <os>macosx</os>
+ <ws>cocoa</ws>
+ <arch>x86_64</arch>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <configuration>
+ <useUIThread>false</useUIThread>
+ <forkedProcessTimeoutInSeconds>${tycho.surefire.timeout}</forkedProcessTimeoutInSeconds>
+ <argLine>${tycho.test.jvmArgs} ${systemProperties}</argLine>
+ <testClass>org.eclipse.linuxtools.docker.integration.tests.DockerAllBotTest</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-build/Dockerfile b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-build/Dockerfile
new file mode 100644
index 0000000..4079050
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-build/Dockerfile
@@ -0,0 +1,2 @@
+FROM alpine:3.3
+MAINTAINER Andre Dietisheim <adietish@redhat.com>
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/Dockerfile b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/Dockerfile
new file mode 100644
index 0000000..5b72099
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/Dockerfile
@@ -0,0 +1,5 @@
+FROM python:2.7
+ADD . /code
+WORKDIR /code
+RUN pip install -r requirements.txt
+CMD python app.py
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/app.py b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/app.py
new file mode 100644
index 0000000..147ae18
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/app.py
@@ -0,0 +1,13 @@
+from flask import Flask
+from redis import Redis
+
+app = Flask(__name__)
+redis = Redis(host='redis', port=6379)
+
+@app.route('/')
+def hello():
+ redis.incr('hits')
+ return 'Hello World! I have been seen %s times.' % redis.get('hits')
+
+if __name__ == "__main__":
+ app.run(host="0.0.0.0", debug=True)
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/docker-compose.yml b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/docker-compose.yml
new file mode 100644
index 0000000..c3b553a
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/docker-compose.yml
@@ -0,0 +1,12 @@
+version: '2'
+services:
+ web:
+ build: .
+ ports:
+ - "5000:5000"
+ volumes:
+ - .:/code
+ depends_on:
+ - redis
+ redis:
+ image: redis
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/requirements.txt b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/requirements.txt
new file mode 100644
index 0000000..1a5dc97
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-compose/requirements.txt
@@ -0,0 +1,2 @@
+flask
+redis
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-variables/Dockerfile b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-variables/Dockerfile
new file mode 100644
index 0000000..0537e47
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-variables/Dockerfile
@@ -0,0 +1,4 @@
+FROM busybox
+ADD run.sh run.sh
+RUN chmod +x run.sh
+CMD ./run.sh
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-variables/run.sh b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-variables/run.sh
new file mode 100644
index 0000000..fbdf14e
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-variables/run.sh
@@ -0,0 +1,8 @@
+# file run.sh
+#!/bin/sh
+
+if [ -z "$FOO" ]; then
+ echo "FOO is empty"
+else
+ echo "FOO is $FOO"
+fi
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-volumes/index.html b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-volumes/index.html
new file mode 100644
index 0000000..5b5cba7
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/resources/test-volumes/index.html
@@ -0,0 +1,5 @@
+<html>
+ <body>
+ Hello World!
+ </body>
+</html>
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/AbstractDockerBotTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/AbstractDockerBotTest.java
new file mode 100644
index 0000000..27da0e7
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/AbstractDockerBotTest.java
@@ -0,0 +1,349 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.linuxtools.docker.integration.tests.container.VolumeMountTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.perspective.DockerPerspective;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView;
+import org.eclipse.linuxtools.docker.reddeer.ui.resources.AuthenticationMethod;
+import org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection;
+import org.jboss.reddeer.core.exception.CoreLayerException;
+import org.jboss.reddeer.core.handler.ShellHandler;
+import org.jboss.reddeer.eclipse.ui.console.ConsoleView;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.jboss.reddeer.junit.runner.RedDeerSuite;
+import org.jboss.reddeer.requirements.openperspective.OpenPerspectiveRequirement.OpenPerspective;
+import org.jboss.reddeer.swt.exception.SWTLayerException;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+@RunWith(RedDeerSuite.class)
+@OpenPerspective(DockerPerspective.class)
+public abstract class AbstractDockerBotTest {
+
+ private static final String JOB_PUSHING_DOCKER_IMAGE = "Pushing Docker Image";
+ private static final String JOB_TAGGING_IMAGE = "Tagging Image";
+ private static final String JOB_PULLING_DOCKER_IMAGE = "Pulling docker image";
+ private static final String JOB_OPENNING_CONNECTION = "Opening connection...";
+ private static final String SYSPROP_DOCKER_MACHINE_NAME = "dockerMachineName";
+ private static final String SYSPROP_DOCKER_SERVER_URI = "dockerServerURI";
+ private static final String SYSPROP_UNIX_SOCKET = "unixSocket";
+ protected static final String SYSPROP_MOCKITO = "dockerMockito";
+
+ protected static final String DEFAULT_CONNECTION_NAME = "default";
+
+ protected DockerConnection connection = null;
+
+ @BeforeClass
+ public static void beforeClass() {
+ deleteAllConnections();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ killRunningImageJobs();
+ cleanupShells();
+ }
+
+ protected static void cleanupShells() {
+ ShellHandler.getInstance().closeAllNonWorbenchShells();
+ }
+
+ protected List<String> getIds(String stringWithIds) {
+ if (StringUtils.isBlank(stringWithIds)) {
+ return Collections.emptyList();
+ }
+ ArrayList<String> idList = new ArrayList<String>();
+ idList = new ArrayList<String>(Arrays.asList(stringWithIds.split("\\r?\\n")));
+ return idList;
+ }
+
+ /**
+ * 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;
+ }
+
+ protected void deleteConnection() {
+ getConnection().removeConnection();
+ this.connection = null;
+ }
+
+ protected String createURL(String tail) {
+ String dockerServerURI = System.getProperty(SYSPROP_DOCKER_SERVER_URI);
+ String serverURI = null;
+ if (!StringUtils.isBlank(System.getProperty(SYSPROP_DOCKER_MACHINE_NAME))
+ || !StringUtils.isBlank(System.getProperty(SYSPROP_UNIX_SOCKET))
+ || StringUtils.isBlank(dockerServerURI)) {
+ serverURI = "http://localhost:1234";
+ } else if (!StringUtils.isBlank(dockerServerURI)) {
+ serverURI = dockerServerURI.replaceAll(DockerExplorerView.SCHEME_TCP, DockerExplorerView.SCHEME_HTTP);
+ }
+ return serverURI.substring(0, serverURI.lastIndexOf(":")) + tail;
+ }
+
+ protected List<String> getImages(String dockerServer) {
+ return getConnection().getImagesNames();
+ }
+
+ protected List<String> getContainers(String dockerServer) {
+ return getConnection().getContainersNames();
+ }
+
+ protected void cleanUpWorkspace() {
+ cleanupShells();
+ killRunningImageJobs();
+ }
+
+ private String getServer() {
+ if (!StringUtils.isBlank(System.getProperty(SYSPROP_DOCKER_SERVER_URI))) {
+ return System.getProperty(SYSPROP_DOCKER_SERVER_URI);
+ } else if (!StringUtils.isBlank(System.getProperty(SYSPROP_UNIX_SOCKET))) {
+ return System.getProperty(SYSPROP_UNIX_SOCKET);
+ } else {
+ return DEFAULT_CONNECTION_NAME;
+ }
+ }
+
+ /**
+ * Returns {@code true} if the configuration for this test is set to use a
+ * host as docker server (unix socket, serverURI). Returns {@code false} if
+ * the configuration for this test is set to use a name as docker server
+ * (docker-machine)
+ *
+ * @return
+ */
+ private boolean isDockerServerHost() {
+ return !StringUtils.isBlank(System.getProperty(SYSPROP_DOCKER_SERVER_URI))
+ || !StringUtils.isBlank(System.getProperty(SYSPROP_UNIX_SOCKET));
+ }
+
+ public static void setSecureStorage(String password) {
+ try {
+ new DefaultShell("Secure Storage Password");
+ new LabeledText("Password:").setText(password);
+ new LabeledText("Confirm password:").setText(password);
+ new PushButton("OK").click();
+ new DefaultShell("Secure Storage - Password Hint Needed");
+ new PushButton("NO").click();
+ } catch (CoreLayerException ex) {
+ new PushButton("OK").click();
+ } catch (SWTLayerException e) {
+ try {
+ new DefaultShell("Secure Storage");
+ new LabeledText("Password:").setText(password);
+ new LabeledText("Confirm password:").setText(password);
+ new PushButton("OK").click();
+ } catch (SWTLayerException ex) {
+ // Secure storage password is set
+ } catch (CoreLayerException ex) {
+ // Confirm password
+ new PushButton("OK").click();
+ }
+ }
+
+ }
+
+ /**
+ * Kills all running jobs that are pulling, tagging or pushing images.
+ */
+ public static void killRunningImageJobs() {
+ Job[] currentJobs = Job.getJobManager().find(null);
+ for (Job job : currentJobs) {
+ String jobName = job.getName();
+ if (jobName.startsWith(JOB_PULLING_DOCKER_IMAGE) || jobName.startsWith(JOB_TAGGING_IMAGE)
+ || jobName.startsWith(JOB_PUSHING_DOCKER_IMAGE) || jobName.startsWith(JOB_OPENNING_CONNECTION)) {
+ job.cancel();
+ }
+ }
+ }
+
+ /**
+ * Returns a connection that matches the current settings. If none is found,
+ * a new one is created.
+ *
+ * @return
+ *
+ * @see #createConnection()
+ */
+ protected DockerConnection getConnection() {
+ if (connection != null) {
+ return connection;
+ }
+
+ if (isDockerServerHost()) {
+ this.connection = getConnectionByHost(getServer());
+ } else if (!mockitoIsUsed()) {
+ this.connection = getConnectionByName(getServer());
+ }
+
+ if (connection == null) {
+ createConnection();
+ }
+ connection.enableConnection();
+ return connection;
+ }
+
+ protected static DockerConnection getConnectionByName(String name) {
+ DockerConnection connection = new DockerExplorerView().getDockerConnectionByName(name);
+ return connection;
+ }
+
+ private DockerConnection getConnectionByHost(String host) {
+ DockerConnection connection = new DockerExplorerView().getDockerConnectionByHost(host);
+ return connection;
+ }
+
+ protected static void deleteAllConnections() {
+ for (String name : new DockerExplorerView().getDockerConnectionNames()) {
+ getConnectionByName(name).removeConnection();
+ }
+ }
+
+ protected void clearConsole() {
+ ConsoleView cview = new ConsoleView();
+ cview.open();
+ try {
+ cview.clearConsole();
+ } catch (CoreLayerException ex) {
+ // swallow intentionally
+ }
+ }
+
+ protected PropertiesView openPropertiesTab(String tabName) {
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ getConnection().select();
+ propertiesView.selectTab(tabName);
+ return propertiesView;
+ }
+
+ protected PropertiesView openPropertiesTabForImage(String tabName, String imageName) {
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ getConnection().getImage(imageName).select();
+ propertiesView.selectTab(tabName);
+ return propertiesView;
+ }
+
+ protected PropertiesView openPropertiesTabForContainer(String tabName, String containerName) {
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ getConnection().getContainer(containerName).select();
+ propertiesView.selectTab(tabName);
+ return propertiesView;
+ }
+
+ protected String getResourceAsString(String path) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ IOUtils.copy(VolumeMountTest.class.getResourceAsStream("/" + path), out);
+ return new String(out.toByteArray());
+ }
+
+ /**
+ * Returns {@code true} if the running docker daemon matches at least the
+ * given major and minor version. Returns {@code false} otherwise.
+ *
+ * @param majorVersion
+ * @param minorVersion
+ * @return
+ */
+ protected boolean isDockerDaemon(int majorVersion, int minorVersion) {
+ PropertiesView infoTab = openPropertiesTab("Info");
+ getConnection().select();
+ String daemonVersion = infoTab.getProperty("Version").getPropertyValue();
+ assertTrue("Could not retrieve docker daemon version.", !StringUtils.isBlank(daemonVersion));
+ String[] versionComponents = daemonVersion.split("\\.");
+ assertTrue("Could not evaluate docker daemon version " + daemonVersion,
+ versionComponents == null || versionComponents.length >= 2);
+ int actualMajorVersion = Integer.parseInt(versionComponents[0]);
+ if (actualMajorVersion > majorVersion) {
+ return true;
+ }
+ int actualMinorVersion = Integer.parseInt(versionComponents[1]);
+ return actualMinorVersion >= minorVersion;
+ }
+
+ protected boolean mockitoIsUsed() {
+ String mockito = System.getProperty(SYSPROP_MOCKITO);
+ return "true".equals(mockito);
+ }
+
+ protected void prepareConnections() {
+ deleteAllConnections();
+ if (mockitoIsUsed()) {
+ MockUtils.createDockerMockConnection(DEFAULT_CONNECTION_NAME);
+ } else {
+ getConnection();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/DockerAllBotTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/DockerAllBotTest.java
new file mode 100644
index 0000000..c77a614
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/DockerAllBotTest.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests;
+
+
+import org.jboss.reddeer.junit.runner.RedDeerSuite;
+import org.eclipse.linuxtools.docker.integration.tests.connection.AddConnectionTest;
+import org.eclipse.linuxtools.docker.integration.tests.container.DockerContainerTest;
+import org.eclipse.linuxtools.docker.integration.tests.container.ExposePortTest;
+import org.eclipse.linuxtools.docker.integration.tests.container.LabelsTest;
+import org.eclipse.linuxtools.docker.integration.tests.container.LinkContainersTest;
+import org.eclipse.linuxtools.docker.integration.tests.container.PrivilegedModeTest;
+import org.eclipse.linuxtools.docker.integration.tests.container.VariablesTest;
+import org.eclipse.linuxtools.docker.integration.tests.container.VolumeMountTest;
+import org.eclipse.linuxtools.docker.integration.tests.image.BuildImageTest;
+import org.eclipse.linuxtools.docker.integration.tests.image.DeleteImagesAfter;
+import org.eclipse.linuxtools.docker.integration.tests.image.HierarchyViewTest;
+import org.eclipse.linuxtools.docker.integration.tests.image.ImageTagTest;
+import org.eclipse.linuxtools.docker.integration.tests.image.PullImageTest;
+import org.eclipse.linuxtools.docker.integration.tests.image.PushImageTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.ComposeTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.ContainerTabTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.DifferentRegistryTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.PerspectiveTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.PropertiesViewTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.SearchDialogTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.ImageTabTest;
+import org.eclipse.linuxtools.docker.integration.tests.ui.LaunchDockerImageTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ *
+ * This is a RedDeer test case for an eclipse application.
+ *
+ * @author jkopriva@redhat.com
+ */
+
+@RunWith(RedDeerSuite.class)
+@Suite.SuiteClasses({
+ PerspectiveTest.class,
+ AddConnectionTest.class,
+ BuildImageTest.class,
+ PullImageTest.class,
+ DockerContainerTest.class,
+ ExposePortTest.class,
+ ImageTabTest.class,
+ ContainerTabTest.class,
+ VolumeMountTest.class,
+ PrivilegedModeTest.class,
+ VariablesTest.class,
+ LinkContainersTest.class,
+ DifferentRegistryTest.class,
+ SearchDialogTest.class,
+ ImageTagTest.class,
+ LabelsTest.class,
+ HierarchyViewTest.class,
+ PropertiesViewTest.class,
+ PushImageTest.class,
+ LaunchDockerImageTest.class,
+ ComposeTest.class,
+
+ DeleteImagesAfter.class
+})
+public class DockerAllBotTest {
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/connection/AddConnectionTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/connection/AddConnectionTest.java
new file mode 100644
index 0000000..d8c644c
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/connection/AddConnectionTest.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.connection;
+
+import org.eclipse.linuxtools.docker.integration.tests.AbstractDockerBotTest;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ */
+public class AddConnectionTest extends AbstractDockerBotTest {
+
+ @Before
+ public void setUp() {
+ deleteAllConnections();
+ }
+
+ @Test
+ public void testAddConnection() {
+ createConnection();
+ }
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/DockerContainerTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/DockerContainerTest.java
new file mode 100644
index 0000000..8a1cffc
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/DockerContainerTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.container;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.condition.ConsoleHasNoChange;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+
+public class DockerContainerTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_NAME = IMAGE_BUSYBOX;
+ private static final String CONTAINER_NAME = "test_run";
+
+ @Before
+ public void before() {
+ clearConsole();
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_NAME);
+ }
+
+ @Test
+ public void testRunDockerContainer() {
+ new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
+ assertTrue("Image has not been found!", imageIsDeployed(getCompleteImageName(IMAGE_NAME)));
+ getConnection().getImage(getCompleteImageName(IMAGE_NAME)).run();
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(CONTAINER_NAME);
+ firstPage.finish();
+ if(mockitoIsUsed()){
+ MockUtils.runContainer(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST, CONTAINER_NAME);
+ }
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+ new WaitWhile(new ConsoleHasNoChange());
+ assertTrue("Container does not exists!",containerIsDeployed(CONTAINER_NAME));
+ }
+
+ @After
+ public void after() {
+ deleteImageContainerAfter(CONTAINER_NAME);
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/ExposePortTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/ExposePortTest.java
new file mode 100644
index 0000000..71fe519
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/ExposePortTest.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.container;
+
+import java.io.IOException;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.docker.reddeer.utils.BrowserContentsCheck;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.condition.ConsoleHasNoChange;
+import org.jboss.reddeer.eclipse.ui.browser.BrowserView;
+import org.junit.After;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class ExposePortTest extends AbstractImageBotTest {
+
+ private static final String CONTAINER_NAME = "test_run_uhttpd";
+ private static final String EXPOSED_PORT = "80";
+
+ @Test
+ public void testExposePort() throws IOException {
+ pullImage(IMAGE_UHTTPD, IMAGE_TAG_LATEST);
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ runContainer(IMAGE_UHTTPD, IMAGE_TAG_LATEST, CONTAINER_NAME, imagesTab);
+ if(mockitoIsUsed()){
+ MockUtils.runContainer(DEFAULT_CONNECTION_NAME, IMAGE_UHTTPD, IMAGE_TAG_LATEST, CONTAINER_NAME);
+ }
+ assertPortIsAccessible(EXPOSED_PORT);
+ }
+
+ private void assertPortIsAccessible(String exposedPort) {
+ BrowserView browserView = new BrowserView();
+ browserView.open();
+ String url = createURL(":" + exposedPort);
+ if (!mockitoIsUsed()) {
+ BrowserContentsCheck.checkBrowserForErrorPage(browserView, url);
+ }
+ }
+
+ private void runContainer(String imageName, String imageTag, String containerName, DockerImagesTab imagesTab) {
+ imagesTab.runImage(imageName + ":" + imageTag);
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(containerName);
+ firstPage.setPublishAllExposedPorts(false);
+ firstPage.finish();
+ new WaitWhile(new JobIsRunning());
+ new WaitWhile(new ConsoleHasNoChange());
+ }
+
+ @After
+ public void after() {
+ deleteContainerIfExists(CONTAINER_NAME);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/LabelsTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/LabelsTest.java
new file mode 100644
index 0000000..64b668c
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/LabelsTest.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.container;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerConnectionManager;
+import org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerInfoFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.spotify.docker.client.DockerClient;
+import com.spotify.docker.client.DockerException;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class LabelsTest extends AbstractImageBotTest {
+
+ private static final String CONTAINER_LABEL_VALUE = "bar";
+ private static final String CONTAINER_LABEL_KEY = "foo";
+ private static final String IMAGE_NAME = IMAGE_BUSYBOX;
+ private static final String IMAGE_TAG = "latest";
+ private static final String CONTAINER_NAME = "test_run_busybox_label";
+
+ @Before
+ public void before() throws DockerException, InterruptedException {
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_NAME, IMAGE_TAG);
+ }
+
+ @Test
+ public void testLabels() {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.runImage(IMAGE_NAME + ":" + IMAGE_TAG);
+
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(CONTAINER_NAME);
+ firstPage.setAllocatePseudoTTY();
+ firstPage.setKeepSTDINOpen();
+ firstPage.setGiveExtendedPrivileges();
+ firstPage.next();
+ ImageRunResourceVolumesVariablesPage secondPage = new ImageRunResourceVolumesVariablesPage();
+ secondPage.addLabel(CONTAINER_LABEL_KEY, CONTAINER_LABEL_VALUE);
+ secondPage.finish();
+ new WaitWhile(new JobIsRunning());
+ if (mockitoIsUsed()) {
+ //MockDockerClientFactory.addContainer(this.client, this.createdContainer, this.containerInfo);
+ runContainer();
+ getConnection().refresh();
+ new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
+ }
+ DockerContainersTab containerTab = new DockerContainersTab();
+ containerTab.searchContainer(CONTAINER_NAME);
+ containerTab.select(CONTAINER_NAME);
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ getConnection().getContainer(CONTAINER_NAME).select();
+ propertiesView.selectTab("Inspect");
+ String labelProp = propertiesView.getProperty("Config", "Labels", CONTAINER_LABEL_KEY).getPropertyValue();
+ assertTrue("Container does not have label " + CONTAINER_LABEL_KEY + "!",
+ labelProp.equals(CONTAINER_LABEL_VALUE));
+ }
+
+ @After
+ public void after() {
+ killRunningImageJobs();
+ deleteContainerIfExists(CONTAINER_NAME);
+ }
+
+ private void runContainer() {
+ Map<String, String> labels = new HashMap<String, String>();
+ labels.put(CONTAINER_LABEL_KEY,CONTAINER_LABEL_VALUE);
+ final DockerClient client = MockDockerClientFactory
+ .container(MockContainerFactory.id("1MockContainer").name(CONTAINER_NAME)
+ .imageName("1a2b3c4d5e6f7g").status("Started 1 second ago").build(),
+ MockContainerInfoFactory.link(IMAGE_NAME + ":" + IMAGE_TAG_LATEST).privilegedMode(true)
+ .id("TestTestTestTestTest").ipAddress("127.0.0.1").labels(labels).build())
+ .image(MockImageFactory.id("1a2b3c4d5e6f7g").name(IMAGE_NAME + ":" + IMAGE_TAG_LATEST).build())
+ .build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(DEFAULT_CONNECTION_NAME, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/LinkContainersTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/LinkContainersTest.java
new file mode 100644
index 0000000..5d1bdf9
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/LinkContainersTest.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.container;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerConnectionManager;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerTerminal;
+import org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerTerminal;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerInfoFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.condition.ConsoleHasNoChange;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.spotify.docker.client.DockerClient;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class LinkContainersTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_ALPINE_CURL = "byrnedo/alpine-curl";
+ private static final String CONTAINER_NAME_HTTP_SERVER = "test_run_httpd";
+ private static final String CONTAINER_NAME_CLIENT_ALPINE = "test_connect_httpd";
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_ALPINE_CURL);
+ pullImage(IMAGE_UHTTPD);
+ }
+
+ private ImageRunSelectionPage openImageRunSelectionPage(String containerName, boolean publishAllExposedPorts) {
+ ImageRunSelectionPage page = new ImageRunSelectionPage();
+ page.setContainerName(containerName);
+ page.setPublishAllExposedPorts(publishAllExposedPorts);
+ return page;
+ }
+
+ @Test
+ public void testLinkContainers() {
+ runUhttpServer(IMAGE_UHTTPD, CONTAINER_NAME_HTTP_SERVER);
+ runAlpineLinux(IMAGE_ALPINE_CURL, CONTAINER_NAME_CLIENT_ALPINE);
+
+ }
+
+ public void runUhttpServer(String imageName, String containerName) {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.runImage(imageName);
+ ImageRunSelectionPage firstPage = openImageRunSelectionPage(containerName, false);
+ firstPage.setContainerName(containerName);
+ firstPage.setPublishAllExposedPorts(false);
+ firstPage.finish();
+ if (mockitoIsUsed()) {
+ mockServerContainer();
+ new WaitUntil(new ContainerIsDeployedCondition(containerName, getConnection()));
+ } else {
+ new WaitWhile(new JobIsRunning());
+ new WaitWhile(new ConsoleHasNoChange());
+ }
+ }
+
+ public void runAlpineLinux(String imageName, String containerName) {
+ String serverAddress = getHttpServerAddress(CONTAINER_NAME_HTTP_SERVER);
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.runImage(imageName);
+ ImageRunSelectionPage firstPage = openImageRunSelectionPage(containerName, false);
+ firstPage.setContainerName(containerName);
+ firstPage.setCommand(serverAddress + ":80");
+ firstPage.addLinkToContainer(CONTAINER_NAME_HTTP_SERVER, "http_server");
+ firstPage.setPublishAllExposedPorts(false);
+ firstPage.setAllocatePseudoTTY();
+ firstPage.setKeepSTDINOpen();
+ firstPage.finish();
+ new WaitWhile(new JobIsRunning());
+ DockerTerminal dt = new DockerTerminal();
+ dt.open();
+ if (mockitoIsUsed()) {
+ mockServerContainer();
+ dt = MockDockerTerminal.setText("text").build();
+ }
+ String terminalText = dt.getTextFromPage("/" + containerName);
+ assertTrue("No output from terminal!", !terminalText.isEmpty());
+ assertTrue("Containers are not linked!", !terminalText.contains("Connection refused"));
+ }
+
+ private String getHttpServerAddress(String containerName) {
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ getConnection().getContainer(containerName).select();
+ propertiesView.selectTab("Inspect");
+ return propertiesView.getProperty("NetworkSettings", "IPAddress").getPropertyValue();
+ }
+
+ @After
+ public void after() {
+ deleteContainerIfExists(CONTAINER_NAME_CLIENT_ALPINE);
+ deleteContainerIfExists(CONTAINER_NAME_HTTP_SERVER);
+ deleteImageIfExists(IMAGE_ALPINE_CURL);
+ }
+
+ private void mockServerContainer() {
+ final DockerClient client = MockDockerClientFactory
+ .container(MockContainerFactory.name(CONTAINER_NAME_HTTP_SERVER).status("Stopped").build(),
+ MockContainerInfoFactory.link(IMAGE_ALPINE).privilegedMode(true).id("TestServerTestServer")
+ .ipAddress("127.0.0.1").build())
+ .image(MockImageFactory.id("1a2b3c4d5e6f7g").name(IMAGE_UHTTPD + ":" + IMAGE_TAG_LATEST).build())
+ .image(MockImageFactory.id("1a2b3c4d5e6f7g").name(IMAGE_ALPINE_CURL + ":" + IMAGE_TAG_LATEST).build())
+ .build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(DEFAULT_CONNECTION_NAME, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/PrivilegedModeTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/PrivilegedModeTest.java
new file mode 100644
index 0000000..b87bbac
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/PrivilegedModeTest.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.container;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerConnectionManager;
+import org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerInfoFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.spotify.docker.client.DockerClient;
+import com.spotify.docker.client.DockerException;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+public class PrivilegedModeTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_NAME = IMAGE_BUSYBOX;
+ private static final String IMAGE_TAG = IMAGE_TAG_LATEST;
+ private static final String CONTAINER_NAME = "test_run_busybox";
+
+ @Before
+ public void before() throws DockerException, InterruptedException {
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_NAME, IMAGE_TAG);
+ }
+
+ @Test
+ public void testPrivilegedMode() {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.runImage(IMAGE_NAME + ":" + IMAGE_TAG);
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(CONTAINER_NAME);
+ firstPage.setAllocatePseudoTTY();
+ firstPage.setKeepSTDINOpen();
+ firstPage.setGiveExtendedPrivileges();
+ firstPage.finish();
+ if (mockitoIsUsed()) {
+ runPrivilegedContainer();
+ // MockDockerClientFactory.addContainer(this.client,
+ // this.createdContainer, this.containerInfo);
+ getConnection().refresh();
+ new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
+ }
+ new WaitWhile(new JobIsRunning());
+ PropertiesView propertiesView = openPropertiesTabForContainer("Inspect", CONTAINER_NAME);
+ String privilegedProp = propertiesView.getProperty("HostConfig", "Privileged").getPropertyValue();
+ assertTrue("Container is not running in privileged mode!", privilegedProp.equals("true"));
+ }
+
+ @After
+ public void after() {
+ deleteContainerIfExists(CONTAINER_NAME);
+ }
+
+ private void runPrivilegedContainer() {
+ final DockerClient client = MockDockerClientFactory
+ .container(MockContainerFactory.name(CONTAINER_NAME).status("Stopped").build(),
+ MockContainerInfoFactory.link(IMAGE_NAME + ":" + IMAGE_TAG_LATEST).privilegedMode(true)
+ .id("TestTestTestTestTest").ipAddress("127.0.0.1").build())
+ .image(MockImageFactory.id("987654321abcde").name(IMAGE_UHTTPD + ":" + IMAGE_TAG_LATEST).build())
+ .build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(DEFAULT_CONNECTION_NAME, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/VariablesTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/VariablesTest.java
new file mode 100644
index 0000000..f5b4095
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/VariablesTest.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.container;
+
+import java.util.Arrays;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerConnectionManager;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerInfoFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageInfoFactory;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.spotify.docker.client.DockerClient;
+import com.spotify.docker.client.DockerException;
+import com.spotify.docker.client.messages.Container;
+import com.spotify.docker.client.messages.ContainerInfo;
+import com.spotify.docker.client.messages.Image;
+import com.spotify.docker.client.messages.ImageInfo;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ */
+
+public class VariablesTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_NAME = "test_variables";
+ private static final String CONTAINER_NAME = "run_" + IMAGE_NAME;
+
+ private DockerClient client;
+ private Container createdContainer;
+ private ContainerInfo containerInfo;
+
+ @Before
+ public void before() throws DockerException, InterruptedException {
+ if (mockitoIsUsed()) {
+ setUpForMockito();
+ }
+
+ }
+
+ @Test
+ public void testVariables() {
+ getConnection();
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ buildImage(IMAGE_NAME, "resources/test-variables", imagesTab);
+ if (mockitoIsUsed()) {
+ MockUtils.pullImage(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST);
+ }
+ assertConsoleSuccess();
+
+ imagesTab.activate();
+ imagesTab.refresh();
+ new WaitWhile(new JobIsRunning());
+
+ imagesTab.runImage(IMAGE_NAME);
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(CONTAINER_NAME);
+ firstPage.next();
+ ImageRunResourceVolumesVariablesPage secondPage = new ImageRunResourceVolumesVariablesPage();
+ secondPage.addEnviromentVariable("FOO", "barbarbar");
+ if (mockitoIsUsed()) {
+ MockDockerClientFactory.addContainer(this.client, this.createdContainer, this.containerInfo);
+ }
+ secondPage.finish();
+ new WaitWhile(new JobIsRunning());
+ assertConsoleContains("FOO is barbarbar");
+ }
+
+ @After
+ public void after() {
+ deleteContainerIfExists(CONTAINER_NAME);
+ deleteImageIfExists(IMAGE_NAME);
+ }
+
+ private void setUpForMockito() throws DockerException, InterruptedException {
+ // images to use
+ final Image image = MockImageFactory.id("1a2b3c4d5e6f7g").name(IMAGE_UHTTPD + ":" + IMAGE_TAG_LATEST).build();
+ final ImageInfo imageInfo = MockImageInfoFactory.volume("/foo/bar").command(Arrays.asList("the", "command"))
+ .entrypoint(Arrays.asList("the", "entrypoint")).env(Arrays.asList("FOO", "barbarbar")).build();
+ // container to be created
+ this.createdContainer = MockContainerFactory.id("1MockContainer").name(CONTAINER_NAME)
+ .imageName("1a2b3c4d5e6f7g").status("Started 1 second ago").build();
+ this.containerInfo = MockContainerInfoFactory.privilegedMode(true).id("TestTestTestTestTest")
+ .ipAddress("127.0.0.1").build();
+ this.client = MockDockerClientFactory.image(image, imageInfo).build();
+ final DockerConnection dockerConnection = MockDockerConnectionFactory.from(DEFAULT_CONNECTION_NAME, client)
+ .withDefaultTCPConnectionSettings();
+ // configure the Connection Manager
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/VolumeMountTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/VolumeMountTest.java
new file mode 100644
index 0000000..885c595
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/container/VolumeMountTest.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.container;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerConnectionManager;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunResourceVolumesVariablesPage;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerInfoFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.condition.ConsoleHasNoChange;
+import org.jboss.reddeer.eclipse.ui.browser.BrowserView;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.spotify.docker.client.DockerClient;
+import com.spotify.docker.client.DockerException;
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ */
+public class VolumeMountTest extends AbstractImageBotTest {
+
+ private static final String CONTAINER_NAME = "test_mount_volumes";
+ private static final String VOLUME_PATH = "resources/test-volumes";
+ private static final String CONTAINER_PATH = "/www";
+ private static final String INDEX_PAGE = "index.html";
+ private static final String INDEX_PAGE_PATH = VOLUME_PATH + "/" + INDEX_PAGE;
+ private static final String HOST_PORT = "80";
+
+ @Before
+ public void before() throws DockerException, InterruptedException {
+ clearConsole();
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_UHTTPD, IMAGE_TAG_LATEST);
+ }
+
+ @Test
+ public void testVolumeMount() throws IOException {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.runImage(IMAGE_UHTTPD + ":" + IMAGE_TAG_LATEST);
+
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(CONTAINER_NAME);
+ firstPage.setPublishAllExposedPorts(true);
+ firstPage.next();
+
+ ImageRunResourceVolumesVariablesPage secondPage = new ImageRunResourceVolumesVariablesPage();
+ String volumePath = (new File(VOLUME_PATH)).getCanonicalPath();
+ secondPage.addDataVolumeToHost(CONTAINER_PATH, volumePath);
+ secondPage.finish();
+ new WaitWhile(new JobIsRunning());
+
+ if (!mockitoIsUsed()) {
+ new WaitWhile(new ConsoleHasNoChange());
+ } else {
+ runServer();
+ new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
+ }
+
+ String indexPage = getIndexPageContent();
+ String indexPageResource = getResourceAsString(INDEX_PAGE_PATH);
+ assertEquals(INDEX_PAGE_PATH + " wasnt mounted/displayed properly.", indexPage, indexPageResource);
+ }
+
+ private String getIndexPageContent() throws IOException {
+ String containerIP = getContainerIP(CONTAINER_NAME);
+ String url = "http://" + containerIP + ":" + HOST_PORT + "/" + INDEX_PAGE;
+ BrowserView browserView = new BrowserView();
+ browserView.open();
+ if (mockitoIsUsed()) {
+ browserView = MockUtils.getBrowserView(INDEX_PAGE_PATH, getResourceAsString(INDEX_PAGE_PATH));
+ }
+ browserView.openPageURL(url);
+ return browserView.getText();
+ }
+
+ private void runServer() {
+ final DockerClient client = MockDockerClientFactory
+ .container(MockContainerFactory.name(CONTAINER_NAME).status("Stopped").build(),
+ MockContainerInfoFactory.link(IMAGE_ALPINE).volume(VOLUME_PATH).id("TestTestTestTestTest")
+ .ipAddress("127.0.0.1").build())
+ .image(MockImageFactory.id("987654321abcde").name(IMAGE_UHTTPD + ":" + IMAGE_TAG_LATEST).build())
+ .build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(DEFAULT_CONNECTION_NAME, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+ @After
+ public void after() {
+ deleteContainerIfExists(CONTAINER_NAME);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/AbstractImageBotTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/AbstractImageBotTest.java
new file mode 100644
index 0000000..5a8f584
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/AbstractImageBotTest.java
@@ -0,0 +1,312 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.integration.tests.image;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.linuxtools.docker.integration.tests.AbstractDockerBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition;
+import org.eclipse.linuxtools.docker.reddeer.preferences.RegistryAccountsPreferencePage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerImage;
+import org.jboss.reddeer.common.exception.RedDeerException;
+import org.jboss.reddeer.common.exception.WaitTimeoutExpiredException;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.condition.ConsoleHasNoChange;
+import org.jboss.reddeer.eclipse.ui.console.ConsoleView;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.jboss.reddeer.jface.preference.PreferenceDialog;
+import org.jboss.reddeer.swt.exception.SWTLayerException;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog;
+import org.junit.After;
+
+/**
+ * A base class tests that build docker images
+ *
+ * @author adietish@redhat.com
+ */
+public class AbstractImageBotTest extends AbstractDockerBotTest {
+
+ protected static final String NAME_TAG_SEPARATOR = ":";
+ protected static final String IMAGE_TAG_LATEST = "latest";
+
+ protected static final String IMAGE_TEST_BUILD = "test_build";
+ protected static final String IMAGE_BUSYBOX = "busybox";
+ protected static final String IMAGE_BUSYBOX_LATEST = IMAGE_BUSYBOX + NAME_TAG_SEPARATOR + IMAGE_TAG_LATEST;
+ protected static final String IMAGE_ALPINE = "alpine";
+ protected static final String IMAGE_ALPINE_TAG = "3.3";
+ protected static final String IMAGE_ALPINE_33 = IMAGE_ALPINE + NAME_TAG_SEPARATOR + IMAGE_ALPINE_TAG;
+
+ protected static final String IMAGE_CIRROS = "cirros";
+ protected static final String IMAGE_CIRROS_TAG = "0.3.4";
+
+ protected static final String IMAGE_UHTTPD = "fnichol/uhttpd";
+
+ protected static final String IMAGE_HELLO_WORLD = "hello-world";
+
+ protected static final String REGISTRY_SERVER_ADDRESS = "registry.access.redhat.com";
+
+ protected static final String IMAGE_RHEL = "rhel7.2";
+
+ protected static final String DOCKERFILE_FOLDER = "resources/test-build";
+
+ protected static final String REGISTRY_URL = "https://index.docker.io";
+
+ private static final String CONSOLE_SUCCESS_MSG = "Successfully built";
+
+ protected static final String MOCKITO = System.getProperty(SYSPROP_MOCKITO);
+
+ @After
+ public void after() {
+ cleanUpWorkspace();
+ }
+
+ protected DockerImagesTab openDockerImagesTab() {
+ DockerImagesTab imageTab = new DockerImagesTab();
+ imageTab.activate();
+ imageTab.refresh();
+
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+
+ return imageTab;
+ }
+
+ protected void buildImage(String imageName, String dockerFileFolder, DockerImagesTab imageTab) {
+ try {
+ String dockerFilePath = new File(dockerFileFolder).getCanonicalPath();
+ getConnection();
+ imageTab.buildImage(imageName, dockerFilePath);
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ } catch (IOException ex) {
+ fail("Resource file not found!");
+ }
+ }
+
+ protected void assertConsoleSuccess() {
+ assertConsoleContains(CONSOLE_SUCCESS_MSG);
+ }
+
+ protected void assertConsoleContains(String text) {
+ new WaitWhile(new ConsoleHasNoChange());
+ ConsoleView consoleView = new ConsoleView();
+ consoleView.open();
+ if (mockitoIsUsed()) {
+ consoleView = MockUtils.getConsoleViewText(text);
+ }
+ assertFalse("Console has no output!", consoleView.getConsoleText().isEmpty());
+ assertTrue("Build has not been successful", consoleView.getConsoleText().contains(text));
+ }
+
+ protected void setUpRegister(String serverAddress, String email, String userName, String password) {
+ PreferenceDialog dialog = new WorkbenchPreferenceDialog();
+ RegistryAccountsPreferencePage page = new RegistryAccountsPreferencePage();
+ dialog.open();
+ dialog.select(page);
+ page.removeRegistry(serverAddress);
+ page.addRegistry(serverAddress, email, userName, password);
+ try {
+ new DefaultShell("New Registry Account").setFocus();
+ } catch (SWTLayerException e) {
+ new DefaultShell("Preferences").setFocus();
+ }
+ new OkButton().click();
+ }
+
+ protected void deleteRegister(String serverAddress) {
+ PreferenceDialog dialog = new WorkbenchPreferenceDialog();
+ RegistryAccountsPreferencePage page = new RegistryAccountsPreferencePage();
+ dialog.open();
+ dialog.select(page);
+ page.removeRegistry(serverAddress);
+ new WaitWhile(new JobIsRunning());
+ new OkButton().click();
+ }
+
+ protected void deleteRegisterIfExists(String serverAddress) {
+ try {
+ deleteRegister(serverAddress);
+ } catch (RedDeerException e) {
+ // swallow intentionally
+ }
+ }
+
+ protected void pullImage(String imageName) {
+ pullImage(imageName, null, null);
+ }
+
+ protected void pullImage(String imageName, String imageTag) {
+ pullImage(imageName, imageTag, null);
+ }
+
+ protected void pullImage(String imageName, String imageTag, String dockerRegister) {
+ if (mockitoIsUsed()) {
+ MockUtils.pullImage(DEFAULT_CONNECTION_NAME, imageName, imageTag == null ? "latest" : imageTag);
+ } else {
+ try {
+ getConnection().pullImage(imageName, imageTag, dockerRegister);
+ } catch (WaitTimeoutExpiredException ex) {
+ killRunningImageJobs();
+ fail("Timeout expired when pulling image:" + imageName + (imageTag == null ? "" : ":" + imageTag)
+ + "!");
+ }
+ }
+ }
+
+ protected String getCompleteImageName(String imageName) {
+ for (String image : getConnection().getImagesNames()) {
+ if (image.contains(imageName)) {
+ imageName = image.replace(":", "");
+ }
+ }
+ return imageName;
+ }
+
+ protected void deleteImageIfExists(String imageName) {
+ deleteImageIfExists(imageName, IMAGE_TAG_LATEST);
+ }
+
+ protected void deleteImageIfExists(String imageName, String imageTag) {
+ String name = getCompleteImageName(imageName);
+ if (imageIsDeployed(name + NAME_TAG_SEPARATOR + imageTag)) {
+ if (mockitoIsUsed()) {
+ MockUtils.removeImage(DEFAULT_CONNECTION_NAME, imageName, imageTag);
+ } else {
+ getConnection().getImage(name, imageTag).remove();
+ }
+ }
+ }
+
+ protected void deleteImage(String imageName) {
+ deleteImage(imageName, IMAGE_TAG_LATEST);
+ }
+
+ protected void deleteImage(String imageName, String imageTag) {
+ if (mockitoIsUsed()) {
+ MockUtils.removeImage(DEFAULT_CONNECTION_NAME, imageName, imageTag);
+ return;
+ }
+ String completeImageName = getCompleteImageName(imageName);
+ DockerImage image = getConnection().getImage(completeImageName, imageTag);
+ if (image == null) {
+ fail("Image " + imageName + ":" + imageTag + "(" + completeImageName + ":" + imageTag + ")"
+ + " does not exists!");
+ }
+ image.remove();
+ }
+
+ protected void deleteImages(List<String> images) {
+ for (String image : images) {
+ deleteImage(image);
+ }
+ }
+
+ protected boolean imageIsDeployed(String imageName) {
+ return getConnection().imageIsDeployed(imageName);
+ }
+
+ protected int deployedImagesCount(String imageName) {
+ return getConnection().deployedImagesCount(imageName);
+ }
+
+ protected boolean containerIsDeployed(String containerName) {
+ return getConnection().containerIsDeployed(containerName);
+ }
+
+ protected void deleteContainerIfExists(String containerName) {
+ if (containerIsDeployed(containerName)) {
+ getConnection().getContainer(containerName).remove();
+ if (!mockitoIsUsed()) {
+ new WaitWhile(new ContainerIsDeployedCondition(containerName, getConnection()));
+ }
+ }
+ }
+
+ protected void deleteContainer(String containerName) {
+ if (!containerIsDeployed(containerName)) {
+ fail("Container " + containerName + " does not exists!");
+ }
+ getConnection().getContainer(containerName).remove();
+ if (!mockitoIsUsed()) {
+ new WaitWhile(new ContainerIsDeployedCondition(containerName, getConnection()));
+ }
+ }
+
+ /**
+ * Deletes the given images. Image names may be provided with tag (ex.
+ * "alpine:3.3"). Also kills all jobs that are still running.
+ *
+ * @param the
+ * names of the image that will be deleted
+ */
+ protected void deleteImageContainerAfter(String... imageContainerNames) {
+ killRunningImageJobs();
+ deleteImageContainer(imageContainerNames);
+ }
+
+ /**
+ * Deletes the given images. Image names may be provided with tag (ex.
+ * "alpine:3.3").
+ *
+ * @param the
+ * names of the image that will be deleted
+ */
+ protected void deleteImageContainer(String... imageContainerNames) {
+ for (String imageContainerName : imageContainerNames) {
+ String[] nameAndTag = imageContainerName.split(":");
+ if (imageIsDeployed(imageContainerName)) {
+ if (nameAndTag.length == 1) {
+ deleteImage(imageContainerName);
+ } else {
+ deleteImage(nameAndTag[0], nameAndTag[1]);
+ }
+ }
+ if (containerIsDeployed(imageContainerName)) {
+ deleteContainer(imageContainerName);
+ }
+ }
+ }
+
+ protected String getContainerIP(String containerName) {
+ PropertiesView propertiesView = openPropertiesTabForContainer("Inspect", containerName);
+ return propertiesView.getProperty("NetworkSettings", "IPAddress").getPropertyValue();
+ }
+
+ protected void addTagToImage(String imageName, String imageTag){
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.activate();
+ if (mockitoIsUsed()) {
+ MockUtils.pullImage(DEFAULT_CONNECTION_NAME, imageName, imageTag);
+ } else {
+ imagesTab.addTagToImage(imageName, imageTag);
+ }
+ }
+
+ protected void removeTagFromImage(String imageName, String imageTagToRemove){
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.activate();
+ if (mockitoIsUsed()) {
+ MockUtils.pullImage(DEFAULT_CONNECTION_NAME, imageName, IMAGE_TAG_LATEST);
+ } else {
+ imagesTab.removeTagFromImage(imageName, imageTagToRemove);
+ }
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/BuildImageTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/BuildImageTest.java
new file mode 100644
index 0000000..efe24cd
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/BuildImageTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.integration.tests.image;
+
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.junit.After;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class BuildImageTest extends AbstractImageBotTest {
+
+ @Test
+ public void testBuildImage() {
+ getConnection();
+ DockerImagesTab imageTab = openDockerImagesTab();
+
+ buildImage(IMAGE_TEST_BUILD, DOCKERFILE_FOLDER, imageTab);
+
+ assertConsoleSuccess();
+ }
+
+ @After
+ public void after() {
+ deleteImageContainer(IMAGE_TEST_BUILD);
+ cleanUpWorkspace();
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/DeleteImagesAfter.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/DeleteImagesAfter.java
new file mode 100644
index 0000000..e717f3c
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/DeleteImagesAfter.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.image;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * This class is deleting all used images in tests. Images are not deleted after
+ * every test to speed up the suite.
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+public class DeleteImagesAfter extends AbstractImageBotTest {
+
+ @Before
+ public void before (){
+ prepareConnections();
+ }
+
+ @Test
+ public void deleteUsedImages() {
+ deleteImageIfExists(IMAGE_ALPINE, IMAGE_ALPINE_TAG);
+ deleteImageIfExists(IMAGE_BUSYBOX);
+ deleteImageIfExists(IMAGE_CIRROS, IMAGE_CIRROS_TAG);
+ deleteImageIfExists(IMAGE_UHTTPD);
+ deleteImageIfExists(IMAGE_HELLO_WORLD);
+ deleteImageIfExists(REGISTRY_SERVER_ADDRESS + "/" + IMAGE_RHEL);
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/HierarchyViewTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/HierarchyViewTest.java
new file mode 100644
index 0000000..445e30b
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/HierarchyViewTest.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.image;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerConnectionManager;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImageHierarchyTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.swt.api.TreeItem;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.spotify.docker.client.DockerClient;
+import com.spotify.docker.client.messages.Image;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @cotributor adietish@redhat.com
+ *
+ */
+
+public class HierarchyViewTest extends AbstractImageBotTest {
+ private static final int DAEMON_MAJOR_VERSION = 11;
+ private static final int DAEMON_MINOR_VERSION = 1;
+
+ private DockerConnection connection;
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ }
+
+ @Test
+ public void testHierarchyView() {
+ DockerImagesTab imageTab = openDockerImagesTab();
+
+ buildImage(IMAGE_TEST_BUILD, DOCKERFILE_FOLDER, imageTab);
+
+ if (mockitoIsUsed()) {
+ buildImage();
+ }
+
+ DockerImageHierarchyTab hierarchyTab = openDockerImageHierarchyTab();
+ List<TreeItem> treeItems = hierarchyTab.getTreeItems();
+ compareTextInFirstNode(treeItems, "alpine:3.3");
+ List<TreeItem> treeItems2 = treeItems.get(0).getItems();
+ compareTextInFirstNode(treeItems2, IMAGE_TEST_BUILD + NAME_TAG_SEPARATOR + IMAGE_TAG_LATEST);
+ }
+
+ public void compareTextInFirstNode(List<TreeItem> treeItems, String expectedValue) {
+ String nodeText = treeItems.get(0).getText().replaceAll("\\(.*\\)", "").trim();
+ if (!mockitoIsUsed() && isDockerDaemon(DAEMON_MAJOR_VERSION, DAEMON_MINOR_VERSION)) {
+ nodeText = nodeText.replaceAll("docker.io/", ""); // On older
+ // deamons is
+ // this prefix
+ }
+ assertTrue("Hierarchy view contains string: " + nodeText + ", but it is expected: " + expectedValue,
+ nodeText.startsWith(expectedValue));
+ }
+
+ private DockerImageHierarchyTab openDockerImageHierarchyTab() {
+ getConnection().getImage(IMAGE_TEST_BUILD).openImageHierarchy();
+ new WaitWhile(new ShellWithTextIsAvailable("Docker Image Hierarchy"));
+ DockerImageHierarchyTab hierarchyTab = new DockerImageHierarchyTab();
+ hierarchyTab.open();
+ return hierarchyTab;
+ }
+
+ @After
+ public void after() {
+ deleteImageContainerAfter(IMAGE_TEST_BUILD);
+ cleanUpWorkspace();
+ }
+
+ public void buildImage() {
+ final Image rootImage = MockImageFactory.id("sha256:alpine:3.3").name("alpine:3.3").build();
+ final Image fooImage1 = MockImageFactory
+ .id("sha256:" + IMAGE_TEST_BUILD + NAME_TAG_SEPARATOR + IMAGE_TAG_LATEST)
+ .name(IMAGE_TEST_BUILD + NAME_TAG_SEPARATOR + IMAGE_TAG_LATEST).parentId("sha256:alpine:3.3").build();
+ final DockerClient client = MockDockerClientFactory.image(rootImage).image(fooImage1).build();
+ this.connection = MockDockerConnectionFactory.from(DEFAULT_CONNECTION_NAME, client)
+ .withDefaultTCPConnectionSettings();
+ this.connection.getImages(true);
+ this.connection.getContainers(true);
+ MockDockerConnectionManager.configureConnectionManager(connection);
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/ImageTagTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/ImageTagTest.java
new file mode 100644
index 0000000..25b8c7e
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/ImageTagTest.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.image;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.jboss.reddeer.common.exception.WaitTimeoutExpiredException;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.swt.impl.button.CancelButton;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+
+public class ImageTagTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_NAME = IMAGE_BUSYBOX;
+ private static final String IMAGE_TAG = "testtag";
+ private static final String IMAGE_TAG_UPPERCASE = "UPPERCASETAG";
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_NAME);
+ getConnection().refresh();
+ new WaitWhile(new JobIsRunning());
+ assertTrue("Image has not been deployed!", imageIsDeployed(IMAGE_NAME));
+ }
+
+ @Test
+ public void testAddRemoveTagToImage() {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.activate();
+ addTagToImage(IMAGE_NAME, IMAGE_TAG);
+ new WaitWhile(new JobIsRunning());
+ assertTrue("Image tag has not been added", imagesTab.getImageTags(IMAGE_NAME).contains(IMAGE_TAG));
+ removeTagFromImage(IMAGE_NAME, IMAGE_TAG);
+ new WaitWhile(new JobIsRunning());
+ assertTrue("ImageTaghasNotBeenRemoved", !imagesTab.getImageTags(IMAGE_NAME).contains(IMAGE_TAG));
+ }
+
+ @Test
+ public void testAddUpperCaseTagToImage() {
+ DockerExplorerView explorer = new DockerExplorerView();
+ explorer.open();
+ try {
+ getConnection().getImage(IMAGE_NAME).addTagToImage(IMAGE_TAG_UPPERCASE);
+ } catch (WaitTimeoutExpiredException ex) {
+ new CancelButton().click();
+ // swallowing, it is not possible to tag image with upper case
+ }
+ }
+
+ @After
+ public void after() {
+ deleteImageContainerAfter(IMAGE_NAME);
+ cleanUpWorkspace();
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/PullImageTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/PullImageTest.java
new file mode 100644
index 0000000..0778402
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/PullImageTest.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.image;
+
+import static org.junit.Assert.assertTrue;
+
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+
+public class PullImageTest extends AbstractImageBotTest {
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ deleteImageIfExists(IMAGE_ALPINE_33);
+ deleteImageIfExists(IMAGE_BUSYBOX_LATEST);
+ }
+
+ @Test
+ public void testPullImageWithTag() {
+ clearConsole();
+ pullImage(IMAGE_ALPINE, IMAGE_ALPINE_TAG, null);
+ new WaitWhile(new JobIsRunning());
+ assertTrue("Image has not been deployed!", imageIsDeployed(IMAGE_ALPINE_33));
+ }
+
+ @Test
+ public void testPullImageWithoutTag() {
+ clearConsole();
+ pullImage(IMAGE_BUSYBOX);
+ new WaitWhile(new JobIsRunning());
+ assertTrue("Image has not been deployed!", imageIsDeployed(IMAGE_BUSYBOX_LATEST));
+ assertTrue("Multiple tags of the same image has been deployed, not only latest tag!",
+ deployedImagesCount(IMAGE_BUSYBOX) == 1);
+ }
+
+ @After
+ public void after() {
+ // cleanup for testPullImageWithoutTag()
+ for (String imageName : getConnection().getImagesNames(true)) {
+ if (imageName.contains(IMAGE_BUSYBOX)) {
+ deleteImageContainer(imageName);// cleanup for
+ // testPullImageWithoutTag()
+ }
+ }
+ cleanUpWorkspace();
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/PushImageTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/PushImageTest.java
new file mode 100644
index 0000000..647d789
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/image/PushImageTest.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.image;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+
+public class PushImageTest extends AbstractImageBotTest {
+
+ private static final String DOCKERFILE_FOLDER = "resources/test-variables";
+ private static final String DOCKER_HUB_PASSWORD = "dockerHubPassword";
+ private static final String DOCKER_HUB_EMAIL = "dockerHubEmail";
+ private static final String DOCKER_HUB_USERNAME = "dockerHubUsername";
+
+ private static final String IMAGE_NAME = "test_push";
+ private static final String REGISTRY_ACCOUNT = System.getProperty(DOCKER_HUB_USERNAME) + "@https://index.docker.io";
+ private static String IMAGE_TAG = System.getProperty(DOCKER_HUB_USERNAME) + "/variables";
+
+ private String imageNewTag = "";
+
+ private String dockerHubUsername = "";
+ private String dockerHubEmail = "";
+ private String dockerHubPassword = "";
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ createConnection();
+ checkCredentials();
+ if (mockitoIsUsed()) {
+ //Set up for Mockito
+ MockUtils.pullImage(DEFAULT_CONNECTION_NAME, IMAGE_NAME, imageNewTag);
+ IMAGE_TAG = "test_push:/variables";
+ getConnection().refresh();
+ }
+ }
+
+ @Test
+ public void pushImage() {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ buildImage(IMAGE_NAME, DOCKERFILE_FOLDER, imagesTab);
+ assertConsoleSuccess();
+
+ setUpRegister(REGISTRY_URL, dockerHubEmail, dockerHubUsername, dockerHubPassword);
+ setSecureStorage("password");
+ String seconds = String.valueOf(new java.util.Date().getTime());
+ this.imageNewTag = IMAGE_TAG + ":" + seconds;
+ addTagToImage(IMAGE_NAME, imageNewTag);
+
+ //new WaitUntil(new JobIsRunning(), TimePeriod.VERY_LONG);
+ if (!mockitoIsUsed()) {
+ getConnection().getImage(IMAGE_TAG, seconds).pushImage(REGISTRY_ACCOUNT, false, false);
+ }
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ deleteImage(IMAGE_TAG, seconds);
+ pullImage(IMAGE_TAG, seconds, REGISTRY_URL);
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ assertTrue("Image has not been pushed/pulled!", imageIsDeployed(IMAGE_TAG));
+ }
+
+ private void checkCredentials(){
+ dockerHubUsername = System.getProperty(DOCKER_HUB_USERNAME);
+ dockerHubEmail = System.getProperty(DOCKER_HUB_EMAIL);
+ dockerHubPassword = System.getProperty(DOCKER_HUB_PASSWORD);
+
+ if (!mockitoIsUsed()){
+ assertFalse("At least one of credentials is null or empty! " + "dockerHubUsername:" + dockerHubUsername
+ + " dockerHubEmail:" + dockerHubEmail + " dockerHubPassword:" + dockerHubPassword + " Aborting test...",
+ StringUtils.isBlank(dockerHubUsername) || StringUtils.isBlank(dockerHubEmail)
+ || StringUtils.isBlank(dockerHubPassword));
+ } else {
+ dockerHubUsername = "user";
+ dockerHubPassword = "password";
+ dockerHubEmail = "some@email.com";
+ }
+ }
+
+ @After
+ public void after() {
+ deleteRegister(REGISTRY_URL);
+ deleteImageContainerAfter(imageNewTag);
+ cleanUpWorkspace();
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockBrowserView.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockBrowserView.java
new file mode 100644
index 0000000..d3a47b5
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockBrowserView.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.mock;
+
+import org.jboss.reddeer.eclipse.ui.browser.BrowserView;
+import org.mockito.Mockito;
+
+public class MockBrowserView {
+
+ public static Builder open() {
+ return new Builder().open();
+ }
+
+ public static Builder openPageURL(String url) {
+ return new Builder().openPageURL(url);
+ }
+
+ public static Builder setText(String text) {
+ return new Builder().setText(text);
+ }
+
+ public static class Builder {
+
+ private String url;
+ private String text;
+
+ public Builder setText(String text) {
+ this.text = text;
+ return this;
+ }
+
+ public Builder openPageURL(String url) {
+ this.url = url;
+ return this;
+ }
+
+ public Builder open() {
+ return this;
+ }
+
+ public BrowserView build() {
+ final BrowserView browserView = Mockito.mock(BrowserView.class);
+ Mockito.when(browserView.getPageURL()).thenReturn(this.url);
+ Mockito.when(browserView.getText()).thenReturn(this.text);
+ return browserView;
+ }
+
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockConsoleView.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockConsoleView.java
new file mode 100644
index 0000000..a7cf883
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockConsoleView.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.mock;
+
+import org.jboss.reddeer.eclipse.ui.console.ConsoleView;
+import org.mockito.Mockito;
+
+public class MockConsoleView {
+
+ public static Builder msg(String msg) {
+ return new Builder().msg(msg);
+ }
+
+ public static class Builder {
+
+ private String msg;
+
+ public Builder msg(String msg) {
+ this.msg = msg;
+ return this;
+ }
+
+ public ConsoleView build() {
+ final ConsoleView consoleView = Mockito.mock(ConsoleView.class);
+ Mockito.when(consoleView.getConsoleText()).thenReturn(this.msg);
+ return consoleView;
+ }
+
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerConnection.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerConnection.java
new file mode 100644
index 0000000..9431933
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerConnection.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.integration.tests.mock;
+
+import org.eclipse.linuxtools.docker.core.EnumDockerConnectionState;
+import org.eclipse.linuxtools.docker.core.IDockerConnection;
+import org.eclipse.linuxtools.docker.core.IDockerImageInfo;
+import org.eclipse.linuxtools.internal.docker.core.DockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
+import org.eclipse.linuxtools.internal.docker.core.TCPConnectionSettings;
+import org.eclipse.linuxtools.internal.docker.core.UnixSocketConnectionSettings;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+
+import com.spotify.docker.client.DockerCertificateException;
+import com.spotify.docker.client.DockerClient;
+
+public class MockDockerConnection {
+
+ /**
+ * Factory for mocked {@link IDockerConnection}
+ */
+
+ public static Builder from(final String name, final DockerClient dockerClient) {
+ return new Builder(name, dockerClient);
+ }
+
+ public static class Builder {
+
+ private final DockerConnection.Builder connectionBuilder;
+
+ private final DockerClient dockerClient;
+
+ private Builder(final String name, final DockerClient dockerClient) {
+ this.connectionBuilder = new DockerConnection.Builder().name(name);
+ this.dockerClient = dockerClient;
+ }
+
+ public DockerConnection withUnixSocketConnectionSettings(final String pathToSocket) {
+ final DockerConnection connection = Mockito
+ .spy(connectionBuilder.unixSocketConnection(new UnixSocketConnectionSettings(pathToSocket)));
+ configureDockerClientFactory(connection, this.dockerClient);
+ configureMockBehaviour(connection);
+ return connection;
+ }
+
+ public DockerConnection withDefaultTCPConnectionSettings() {
+ return withTCPConnectionSettings(null, null);
+ }
+
+ public DockerConnection withTCPConnectionSettings(final String host, final String pathToCerts) {
+ final DockerConnection connection = Mockito
+ .spy(connectionBuilder.tcpConnection(new TCPConnectionSettings(host, pathToCerts)));
+ configureDockerClientFactory(connection, this.dockerClient);
+ configureMockBehaviour(connection);
+ return connection;
+ }
+
+ public DockerConnection withState(final EnumDockerConnectionState state) {
+ final DockerConnection connection = withDefaultTCPConnectionSettings();
+ Mockito.when(connection.getState()).thenReturn(state);
+ return connection;
+ }
+
+ private static void configureMockBehaviour(final DockerConnection connection) {
+ final IDockerImageInfo imageInfo = Mockito.mock(IDockerImageInfo.class, Mockito.RETURNS_DEEP_STUBS);
+ Mockito.when(connection.getImageInfo(Matchers.anyString())).thenReturn(imageInfo);
+ // Mockito.when(connection.isOpen()).thenReturn(state ==
+ // EnumDockerConnectionState.ESTABLISHED);
+ }
+
+ private static void configureDockerClientFactory(final DockerConnection connection,
+ final DockerClient dockerClient) {
+ final DockerClientFactory dockerClientFactory = Mockito.mock(DockerClientFactory.class);
+ connection.setDockerClientFactory(dockerClientFactory);
+ try {
+ // return dockerClient without auth
+ Mockito.when(dockerClientFactory.getClient(Matchers.any())).thenReturn(dockerClient);
+ // return same dockerClient with auth arg
+ Mockito.when(dockerClientFactory.getClient(Matchers.any(), Matchers.any())).thenReturn(dockerClient);
+ } catch (DockerCertificateException e) {
+ // rest assured, nothing will happen while mocking the
+ // DockerClientFactory
+ }
+ }
+
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerConnectionManager.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerConnectionManager.java
new file mode 100644
index 0000000..2892f53
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerConnectionManager.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.mock;
+
+import org.eclipse.linuxtools.docker.core.DockerConnectionManager;
+import org.eclipse.linuxtools.docker.core.IDockerConnection;
+import org.eclipse.linuxtools.docker.core.IDockerConnectionStorageManager;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionStorageManagerFactory;
+
+public class MockDockerConnectionManager {
+
+ /**
+ * Configures the {@link DockerConnectionManager} with the given array of
+ * {@link IDockerConnection} (can be mocked) and refreshes the associated
+ * {@link DockerExplorerView}.
+ *
+ * @param connections
+ * the connection to configure in the
+ * {@link DockerConnectionManager} via a mocked
+ * {@link IDockerConnectionStorageManager}
+ */
+ public static void configureConnectionManager(final IDockerConnection... connections) {
+ final IDockerConnectionStorageManager connectionStorageManager = MockDockerConnectionStorageManagerFactory
+ .providing(connections);
+ configureConnectionManager(connectionStorageManager);
+ }
+
+ /**
+ * Configures the {@link DockerConnectionManager} with the given array of
+ * {@link IDockerConnection} (can be mocked) and refreshes the associated
+ * {@link DockerExplorerView}.
+ *
+ * @param connectionStorageManager
+ * the {@link IDockerConnectionStorageManager} to use (can be
+ * mocked)
+ */
+ public static void configureConnectionManager(final IDockerConnectionStorageManager connectionStorageManager) {
+ DockerConnectionManager.getInstance().setConnectionStorageManager(connectionStorageManager);
+ DockerConnectionManager.getInstance().reloadConnections();
+
+ DockerExplorerView de = new DockerExplorerView();
+ de.open();
+ de.refreshView();
+
+ DockerImagesTab imageTab = new DockerImagesTab();
+ imageTab.activate();
+ imageTab.refresh();
+
+ DockerContainersTab containerTab = new DockerContainersTab();
+ containerTab.activate();
+ containerTab.refresh();
+
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerTerminal.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerTerminal.java
new file mode 100644
index 0000000..8784452
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockDockerTerminal.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.integration.tests.mock;
+
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerTerminal;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+
+public class MockDockerTerminal {
+
+ public static Builder setText(String text) {
+ return new Builder().setText(text);
+ }
+
+ public static class Builder {
+
+ private String text;
+
+ public Builder setText(String text) {
+ this.text = text;
+ return this;
+ }
+
+ public DockerTerminal build() {
+ final DockerTerminal dockerTerminal = Mockito.mock(DockerTerminal.class);
+ Mockito.when(dockerTerminal.getTextFromPage(Matchers.anyString())).thenReturn(this.text);
+ return dockerTerminal;
+ }
+
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockUtils.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockUtils.java
new file mode 100644
index 0000000..61a16ba
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/mock/MockUtils.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.integration.tests.mock;
+
+import static org.junit.Assert.assertTrue;
+import com.spotify.docker.client.messages.ContainerInfo;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.linuxtools.docker.core.IDockerConnection;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockContainerInfoFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionSettingsFinder;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageFactory;
+import org.jboss.reddeer.eclipse.ui.browser.BrowserView;
+import org.jboss.reddeer.eclipse.ui.console.ConsoleView;
+
+import com.spotify.docker.client.DockerClient;
+
+public class MockUtils {
+
+ public static void createDockerMockConnection(String connectionName) {
+ DockerExplorerView de = new DockerExplorerView();
+ de.open();
+ File dockerSocketTmpFile = null;
+ try {
+ dockerSocketTmpFile = File.createTempFile("dockerMock", ".sock");
+ } catch (IOException e) {
+ new Exception("Cannot create mocked Docker connection!");
+ e.printStackTrace();
+ }
+ MockDockerConnectionSettingsFinder.validUnixSocketConnectionAvailable(connectionName,
+ "unix://" + dockerSocketTmpFile.getAbsolutePath());
+ de.createDockerConnectionUnix(
+ configureUnixSocketConnection(connectionName, "unix://" + dockerSocketTmpFile.getAbsolutePath()));
+ assertTrue("Docker connection does not exist! ", de.connectionExistForName(connectionName));
+
+ }
+
+ 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;
+ }
+
+ public static void pullImage(String connectionName, String imageName, String imageTag) {
+ final DockerClient client = MockDockerClientFactory
+ .image(MockImageFactory.id("987654321abcde").name(imageName + ":" + imageTag).build()).build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(connectionName, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+ public static void removeImage(String connectionName, String imageName, String imageTag) {
+ final DockerClient client = MockDockerClientFactory.build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(connectionName, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+ public static void runContainer(String connectionName, String imageName, String imageTag, String containerName) {
+ final DockerClient client = MockDockerClientFactory
+ .container(MockContainerFactory.name(containerName).status("Stopped").build())
+ .image(MockImageFactory.id("987654321abcde").name(imageName + ":" + imageTag).build()).build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(connectionName, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+ public static void runContainer(String connectionName, String imageName, String imageTag, String containerName, ContainerInfo containerInfo) {
+ final DockerClient client = MockDockerClientFactory
+ .container(MockContainerFactory.name(containerName).status("Stopped").build(), MockContainerInfoFactory.link("alpine").volume("resources/test-volumes/index.html").id("TestTestTestTestTest")
+ .ipAddress("127.0.0.1").build())
+ .image(MockImageFactory.id("987654321abcde").name(imageName + ":" + imageTag).build()).build();
+ final org.eclipse.linuxtools.internal.docker.core.DockerConnection dockerConnection = MockDockerConnectionFactory
+ .from(connectionName, client).withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+ public static ConsoleView getConsoleViewText(String msg) {
+ final ConsoleView cv = MockConsoleView.msg(msg).build();
+ return cv;
+ }
+
+ public static BrowserView getBrowserView(String url, String text) {
+ final BrowserView browser = MockBrowserView.openPageURL(url).setText(text).build();
+ return browser;
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ComposeTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ComposeTest.java
new file mode 100644
index 0000000..757b227
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ComposeTest.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.linuxtools.docker.core.DockerException;
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.preferences.DockerComposePreferencePage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.eclipse.linuxtools.docker.reddeer.utils.BrowserContentsCheck;
+import org.eclipse.linuxtools.internal.docker.core.DockerCompose;
+import org.eclipse.linuxtools.internal.docker.core.ProcessLauncher;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.CustomMatchers;
+import org.jboss.reddeer.common.matcher.RegexMatcher;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.matcher.WithTextMatcher;
+import org.jboss.reddeer.eclipse.condition.ConsoleHasNoChange;
+import org.jboss.reddeer.eclipse.jdt.ui.packageexplorer.PackageExplorer;
+import org.jboss.reddeer.eclipse.ui.browser.BrowserView;
+import org.jboss.reddeer.jface.preference.PreferenceDialog;
+import org.jboss.reddeer.swt.api.Menu;
+import org.jboss.reddeer.swt.exception.SWTLayerException;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.combo.LabeledCombo;
+import org.jboss.reddeer.swt.impl.menu.ContextMenu;
+import org.jboss.reddeer.swt.impl.menu.ShellMenu;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Matchers;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class ComposeTest extends AbstractImageBotTest {
+
+ private static final String FILE_DOCKER_COMPOSE = "docker-compose.yml";
+ private static final String SYSPROP_DOCKER_COMPOSE_PATH = "dockerComposePath";
+ private static final String PATH_TEST_COMPOSE = "resources/test-compose";
+ private static final String PROJECT_TEST_COMPOSE = "test-compose";
+ private static final String IMAGE_NAME = "test_compose";
+ private static final String URL = "http://0.0.0.0:5000/";
+ private String dockerComposePath = System.getProperty(SYSPROP_DOCKER_COMPOSE_PATH);
+
+ // for Mockito
+ private CountDownLatch latch;
+
+ @Before
+ public void before() throws DockerException, InterruptedException {
+ if (!mockitoIsUsed()) {
+ org.junit.Assume.assumeTrue(!StringUtils.isBlank(this.dockerComposePath));
+ assertTrue(
+ "Please provide -D" + SYSPROP_DOCKER_COMPOSE_PATH
+ + "=<path to docker-compose binary> in your launch parameters.",
+ !StringUtils.isBlank(this.dockerComposePath));
+ }
+ deleteAllConnections();
+ if (mockitoIsUsed()) {
+ MockUtils.createDockerMockConnection(DEFAULT_CONNECTION_NAME);
+ // configure the 'docker-compose up' mocks with a CountDownLatch to
+ // simulate a long-running process
+ final ProcessLauncher mockProcessLauncher = Mockito.mock(ProcessLauncher.class, Mockito.RETURNS_DEEP_STUBS);
+ DockerCompose.getInstance().setProcessLauncher(mockProcessLauncher);
+ setupDockerComposeUpMockProcess(mockProcessLauncher);
+ // configure the 'docker-compose stop' mocks which release the
+ // CountDownLatch to halt the long-running process
+ setupDockerComposeStopMockProcess(mockProcessLauncher);
+ // Create temp file for DockerCompose
+ @SuppressWarnings("unused")
+ File dockerComposeTmpFile = null;
+ String tempDir = System.getProperty("java.io.tmpdir");
+ dockerComposeTmpFile = new File(tempDir, "docker-compose");
+ this.dockerComposePath = tempDir;
+ }
+
+ }
+
+ @Test
+ public void testCompose() {
+ // Set up Docker Compose location
+ PreferenceDialog dialog = new WorkbenchPreferenceDialog();
+ DockerComposePreferencePage composePreference = new DockerComposePreferencePage();
+ dialog.open();
+ dialog.select(composePreference);
+ composePreference.setPathToDockerCompose(this.dockerComposePath);
+ composePreference.apply();
+ new OkButton().click();
+
+ // Build Image
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ buildImage(IMAGE_NAME, PATH_TEST_COMPOSE, imagesTab);
+ assertConsoleSuccess();
+
+ // Import resource folder
+ importProject(PATH_TEST_COMPOSE);
+
+ // Run Docker Compose
+ runDockerCompose(PROJECT_TEST_COMPOSE, FILE_DOCKER_COMPOSE);
+
+ // Check if application is running
+ BrowserView browserView = new BrowserView();
+ browserView.open();
+ //Skip browser contents check, if mockito is used
+ if (!mockitoIsUsed()) {
+ browserView.openPageURL(URL);
+ BrowserContentsCheck.checkBrowserForErrorPage(browserView, URL);
+ }
+
+ }
+
+ private void runDockerCompose(String project, String projectFile) {
+ PackageExplorer pe = new PackageExplorer();
+ pe.open();
+ pe.getProject(project).getProjectItem(projectFile).select();
+ @SuppressWarnings("unchecked")
+ Menu contextMenu = new ContextMenu(new WithTextMatcher("Run As"), new RegexMatcher(".*Docker Compose"));
+ contextMenu.select();
+ new OkButton().click();
+ try {
+ new DefaultShell("Docker Compose");
+ new OkButton().click();
+ fail("Docker Compose has not been found! Is it installed and the path is correct?");
+ } catch (SWTLayerException ex) {
+ }
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ new WaitWhile(new ConsoleHasNoChange());
+ }
+
+ private void importProject(String path) {
+ new ShellMenu("File", "Open Projects from File System...").select();
+ new LabeledCombo("Import source:").setText(path);
+ new FinishButton().click();
+ new WaitWhile(new JobIsRunning());
+ }
+
+ private void setupDockerComposeUpMockProcess(final ProcessLauncher mockProcessLauncher)
+ throws DockerException, InterruptedException {
+ final Process mockDockerComposeUpProcess = Mockito.mock(Process.class);
+ Mockito.when(mockDockerComposeUpProcess.getInputStream())
+ .thenReturn(new ByteArrayInputStream("up!\n".getBytes()));
+ Mockito.when(mockDockerComposeUpProcess.getErrorStream()).thenReturn(new ByteArrayInputStream("".getBytes()));
+ Mockito.when(mockDockerComposeUpProcess.getOutputStream()).thenReturn(new ByteArrayOutputStream());
+ Mockito.when(mockProcessLauncher.processBuilder(Matchers.anyString(),
+ Matchers.eq(DockerCompose.getDockerComposeCommandName()), CustomMatchers.arrayContains("up"))
+ .workingDir(Matchers.anyString()).start()).thenReturn(mockDockerComposeUpProcess);
+ latch = new CountDownLatch(1);
+ Mockito.when(mockDockerComposeUpProcess.waitFor()).then(new Answer<Object>() {
+
+ @Override
+ public Object answer(InvocationOnMock invocation) throws Throwable {
+ latch.await(5, TimeUnit.SECONDS);
+ return 0;
+ }
+ });
+ }
+
+ private void setupDockerComposeStopMockProcess(final ProcessLauncher mockProcessLauncher)
+ throws DockerException, InterruptedException {
+ final Process mockDockerComposeStopProcess = Mockito.mock(Process.class);
+ Mockito.when(mockDockerComposeStopProcess.getInputStream())
+ .thenReturn(new ByteArrayInputStream("stop\n".getBytes()));
+ Mockito.when(mockDockerComposeStopProcess.getErrorStream()).thenReturn(new ByteArrayInputStream("".getBytes()));
+ Mockito.when(mockDockerComposeStopProcess.getOutputStream()).thenReturn(new ByteArrayOutputStream());
+
+ Mockito.when(mockProcessLauncher.processBuilder(Matchers.anyString(),
+ Matchers.eq(DockerCompose.getDockerComposeCommandName()), CustomMatchers.arrayContains("stop"))
+ .workingDir(Matchers.anyString()).start()).thenReturn(mockDockerComposeStopProcess);
+ Mockito.when(mockDockerComposeStopProcess.waitFor()).then(invocation -> {
+ latch.countDown();
+ return 0;
+ });
+ }
+
+ @After
+ public void after() {
+ deleteImageContainerAfter("testcompose_web_1", "testcompose_redis_1", "testcompose_web", "test_compose",
+ "python:2.7", "redis");
+ cleanUpWorkspace();
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ContainerTabTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ContainerTabTest.java
new file mode 100644
index 0000000..6e9ee23
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ContainerTabTest.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.jboss.reddeer.swt.api.TableItem;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class ContainerTabTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_NAME = IMAGE_BUSYBOX;
+ private static final String CONTAINER_NAME = "test_run_busybox";
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_NAME);
+ }
+
+ @Test
+ public void testContainerTab() {
+ runContainer(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST, CONTAINER_NAME);
+ DockerContainersTab containerTab = new DockerContainersTab();
+ containerTab.activate();
+ containerTab.refresh();
+
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+
+ // get values from Container Tab
+ String nameFromTable = "";
+ String imageFromTable = "";
+ String createdFromTable = "";
+ String commandFromTable = "";
+ String portsFromTable = "";
+ String statusFromTable = "";
+
+ containerTab.refresh();
+ TableItem item = getContainerItem(CONTAINER_NAME, containerTab);
+ assertNotNull("Container tab item " + CONTAINER_NAME + " was not found.", item);
+ nameFromTable = item.getText();
+ imageFromTable = item.getText(1);
+ createdFromTable = item.getText(2);
+ commandFromTable = item.getText(3);
+ portsFromTable = item.getText(4);
+ statusFromTable = item.getText(5);
+
+ // get values from Properties view
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ getConnection().getContainer(CONTAINER_NAME).select();
+ propertiesView.selectTab("Info");
+ String nameProp = propertiesView.getProperty("Names").getPropertyValue();
+ String imageProp = propertiesView.getProperty("Image").getPropertyValue();
+ String createdProp = propertiesView.getProperty("Created").getPropertyValue();
+ String commandProp = propertiesView.getProperty("Command").getPropertyValue();
+ String portsProp = propertiesView.getProperty("Ports").getPropertyValue();
+ String statusProp = propertiesView.getProperty("Status").getPropertyValue();
+
+ // compare values
+ assertTrue("Name in table and in Properties do not match!(" + nameProp + "-" + nameFromTable + ")",
+ nameFromTable.contains(nameProp));
+ assertTrue("Image in table and in Properties do not match!(" + imageProp + "-" + imageFromTable + ")",
+ imageProp.equals(imageFromTable));
+ assertTrue("Created in table and in Properties do not match!(" + createdProp + "-" + createdFromTable + ")",
+ createdProp.equals(createdFromTable));
+ assertTrue("Command in table and in Properties do not match!(" + commandProp + "-" + commandFromTable + ")",
+ commandProp.startsWith(commandFromTable));
+ assertTrue("Ports in table and in Properties do not match!(" + portsProp + "-" + portsFromTable + ")",
+ portsProp.startsWith(portsFromTable));
+ assertTrue("Status in table and in Properties do not match!(" + statusProp + "-" + statusFromTable + ")",
+ statusProp.startsWith(statusFromTable));
+ }
+
+ @Test
+ public void testContainerTabSearch() {
+ runContainer(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST, CONTAINER_NAME);
+ DockerContainersTab containerTab = new DockerContainersTab();
+ containerTab.activate();
+ containerTab.refresh();
+ containerTab.searchContainer("aaa");
+ assertTrue("Search result is not 0!", containerTab.getTableItems().size() == 0);
+ containerTab.searchContainer("");
+ assertTrue("Search result is 0!", containerTab.getTableItems().size() > 0);
+ }
+
+ private void runContainer(String connectionName, String imageName, String imageTag, String containerName){
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.runImage(imageName);
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(containerName);
+ firstPage.finish();
+ if (mockitoIsUsed()) {
+ MockUtils.runContainer(connectionName, imageName, imageTag, containerName);
+ }
+ getConnection().refresh();
+ new WaitWhile(new JobIsRunning());
+ }
+
+ private TableItem getContainerItem(String containerName, DockerContainersTab containersTab) {
+ for (TableItem item : containersTab.getTableItems()) {
+ if (item.getText(0).contains(containerName)) {
+ return item;
+ }
+ }
+ return null;
+ }
+
+ @After
+ public void after() {
+ deleteContainerIfExists(CONTAINER_NAME);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/DifferentRegistryTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/DifferentRegistryTest.java
new file mode 100644
index 0000000..0da0cbb
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/DifferentRegistryTest.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ */
+public class DifferentRegistryTest extends AbstractImageBotTest {
+
+ private static final String EMAIL = "test@test.com";
+ private static final String USERNAME = "test";
+ private static final String PASSWORD = "password";
+ private static final String IMAGE_RHEL = "rhel";
+ private static final String IMAGE_RHEL_TAG = "7.2";
+
+ @Before
+ public void before() {
+ prepareConnections();
+ deleteImageIfExists(REGISTRY_SERVER_ADDRESS + "/" + IMAGE_RHEL);
+ deleteRegisterIfExists(REGISTRY_SERVER_ADDRESS);
+ }
+
+ @Test
+ public void testDifferentRegistry() {
+ clearConsole();
+ setUpRegister(REGISTRY_SERVER_ADDRESS, EMAIL, USERNAME, PASSWORD);
+ setSecureStorage(PASSWORD);
+ pullImage(IMAGE_RHEL, IMAGE_RHEL_TAG, USERNAME + "@" + REGISTRY_SERVER_ADDRESS);
+ assertTrue("Image is not deployed!", imageIsDeployed(IMAGE_RHEL));
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ImageTabTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ImageTabTest.java
new file mode 100644
index 0000000..f1a60ee
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/ImageTabTest.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.jboss.reddeer.swt.api.TableItem;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class ImageTabTest extends AbstractImageBotTest {
+
+ @Before
+ public void before() {
+ clearConsole();
+ deleteAllConnections();
+ getConnection();
+ }
+
+ @Test
+ public void testImageTab() {
+ pullImage(IMAGE_HELLO_WORLD);
+ DockerImagesTab imageTab = new DockerImagesTab();
+ imageTab.activate();
+ imageTab.refresh();
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+
+ String idFromTable = "";
+ String repoTagsFromTable = "";
+ String createdFromTable = "";
+ String sizeFromTable = "";
+
+ for (TableItem item : imageTab.getTableItems()) {
+ if (item.getText(1).contains(IMAGE_HELLO_WORLD)) {
+ idFromTable = item.getText();
+ repoTagsFromTable = item.getText(1);
+ createdFromTable = item.getText(2);
+ sizeFromTable = item.getText(3).replaceAll(".", "").replaceAll(" MB", "");
+ item.click();
+ }
+ }
+ idFromTable = idFromTable.replace("sha256:", "");
+
+ getConnection().getImage(getCompleteImageName(IMAGE_HELLO_WORLD)).select();
+
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ propertiesView.selectTab("Info");
+ String idProp = propertiesView.getProperty("Id").getPropertyValue();
+ String repoTagsProp = propertiesView.getProperty("RepoTags").getPropertyValue();
+ String createdProp = propertiesView.getProperty("Created").getPropertyValue();
+ String sizeProp = propertiesView.getProperty("VirtualSize").getPropertyValue();
+
+ assertTrue("Id in table and in Properties do not match!", idProp.contains(idFromTable));
+ assertTrue("RepoTags in table and in Properties do not match!", repoTagsProp.equals(repoTagsFromTable));
+ assertTrue("Created in table and in Properties do not match!", createdProp.equals(createdFromTable));
+ assertTrue("Size in table and in Properties do not match!", sizeProp.startsWith(sizeFromTable));
+ }
+
+ @Test
+ public void testImageTabSearch() {
+ pullImage(IMAGE_HELLO_WORLD);
+ DockerImagesTab imageTab = new DockerImagesTab();
+ imageTab.activate();
+ imageTab.refresh();
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+ imageTab.searchImage("aaa");
+ assertTrue("Search result is not 0!", imageTab.getTableItems().size() == 0);
+ imageTab.searchImage("");
+ assertTrue("Search result is 0!", imageTab.getTableItems().size() > 0);
+ }
+
+ @After
+ public void after() {
+ deleteImageContainerAfter(IMAGE_HELLO_WORLD);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/LaunchDockerImageTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/LaunchDockerImageTest.java
new file mode 100644
index 0000000..32f1595
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/LaunchDockerImageTest.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.condition.ContainerIsDeployedCondition;
+import org.eclipse.linuxtools.docker.reddeer.ui.RunDockerImageLaunchConfiguration;
+import org.jboss.reddeer.common.exception.RedDeerException;
+import org.jboss.reddeer.common.exception.WaitTimeoutExpiredException;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.handler.ShellHandler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ */
+
+public class LaunchDockerImageTest extends AbstractImageBotTest {
+
+ private static final String CONTAINER_NAME = "test_variables";
+ private static final String CONFIGURATION_NAME = "test_configuration";
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_HELLO_WORLD);
+ }
+
+ @Test
+ public void testLaunchConfiguration() {
+ String imageName = getCompleteImageName(IMAGE_HELLO_WORLD);
+
+ RunDockerImageLaunchConfiguration runImageConf = new RunDockerImageLaunchConfiguration();
+ try {
+ runDockerImageLaunchConfiguration(imageName + NAME_TAG_SEPARATOR + IMAGE_TAG_LATEST, CONTAINER_NAME,
+ CONFIGURATION_NAME, runImageConf);
+ if (mockitoIsUsed()) {
+ MockUtils.runContainer(DEFAULT_CONNECTION_NAME, imageName, IMAGE_TAG_LATEST, CONTAINER_NAME);
+ getConnection().refresh();
+ new WaitUntil(new ContainerIsDeployedCondition(CONTAINER_NAME, getConnection()));
+ }
+ } catch (WaitTimeoutExpiredException ex) {
+ throw ex;
+ }
+ assertTrue("Container is not deployed!", containerIsDeployed(CONTAINER_NAME));
+ }
+
+ private void runDockerImageLaunchConfiguration(String imageName, String containerName, String configurationName,
+ RunDockerImageLaunchConfiguration runImageConf) {
+ runImageConf.open();
+ runImageConf.createNewConfiguration(configurationName);
+ runImageConf.setContainerName(containerName);
+ runImageConf.selectImage(imageName);
+ runImageConf.setPrivilegedMode(true);
+ runImageConf.apply();
+ runImageConf.runConfiguration(configurationName);
+ new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
+ }
+
+ private void deleteIfExists(String configurationName) {
+ RunDockerImageLaunchConfiguration runImageConf = new RunDockerImageLaunchConfiguration();
+ try {
+ runImageConf.open();
+ runImageConf.deleteRunConfiguration(configurationName);
+ runImageConf.close();
+ } catch (RedDeerException e) {
+ // catched intentionally
+ }
+ }
+
+ @After
+ public void after() {
+ ShellHandler.getInstance().closeAllNonWorbenchShells();
+ deleteIfExists(CONFIGURATION_NAME);
+ deleteImageContainerAfter(CONTAINER_NAME);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/PerspectiveTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/PerspectiveTest.java
new file mode 100644
index 0000000..33d180c
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/PerspectiveTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.junit.Test;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+public class PerspectiveTest {
+
+ @Test
+ public void testDockerExplorerViewPresent() {
+ new DockerExplorerView().open();
+ }
+
+ @Test
+ public void testDockerImagesTabPresent() {
+ DockerImagesTab tab = new DockerImagesTab();
+ tab.open();
+ }
+
+ @Test
+ public void testDockerContainersTabPresent() {
+ DockerContainersTab tab = new DockerContainersTab();
+ tab.open();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/PropertiesViewTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/PropertiesViewTest.java
new file mode 100644
index 0000000..6f62b05
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/PropertiesViewTest.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockUtils;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab;
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.eclipse.ui.views.properties.PropertiesView;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+public class PropertiesViewTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_NAME = IMAGE_BUSYBOX;
+ private static final String CONTAINER_NAME = "test_run_docker_busybox";
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ pullImage(IMAGE_NAME);
+ }
+
+ @Test
+ public void testContainerPropertiesTab() {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.runImage(IMAGE_NAME);
+ ImageRunSelectionPage firstPage = new ImageRunSelectionPage();
+ firstPage.setContainerName(CONTAINER_NAME);
+ firstPage.finish();
+ // new WaitWhile(new ContainerIsDeployedCondition(CONTAINER_NAME,
+ // getConnection()));
+ DockerContainersTab containerTab = new DockerContainersTab();
+ containerTab.activate();
+ containerTab.refresh();
+ new WaitWhile(new JobIsRunning());
+ if (mockitoIsUsed()) {
+ MockUtils.runContainer(DEFAULT_CONNECTION_NAME, IMAGE_NAME, IMAGE_TAG_LATEST, CONTAINER_NAME);
+ }
+ getConnection();
+ // open Properties view
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ containerTab.select(CONTAINER_NAME);
+ propertiesView.selectTab("Info");
+ }
+
+ @Test
+ public void testImagePropertiesTab() {
+ DockerImagesTab imagesTab = openDockerImagesTab();
+ imagesTab.selectImage(IMAGE_NAME);
+ // DockerExplorerView de = new DockerExplorerView();
+ // de.open();
+ // de.getDockerConnectionByName(getConnection().getName()).getImage(IMAGE_NAME).select();
+ PropertiesView propertiesView = new PropertiesView();
+ propertiesView.open();
+ propertiesView.selectTab("Info");
+ }
+
+ @After
+ public void after() {
+ deleteContainerIfExists(CONTAINER_NAME);
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/SearchDialogTest.java b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/SearchDialogTest.java
new file mode 100644
index 0000000..9e8fe3c
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.integration.tests/src/org/eclipse/linuxtools/docker/integration/tests/ui/SearchDialogTest.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.integration.tests.ui;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest;
+import org.eclipse.linuxtools.docker.integration.tests.mock.MockDockerConnectionManager;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageSearchPage;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageTagSelectionPage;
+import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerClientFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionFactory;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockImageSearchResultFactory;
+import org.jboss.reddeer.common.wait.AbstractWait;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.condition.ProgressInformationShellIsActive;
+import org.jboss.reddeer.swt.impl.button.CancelButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.spotify.docker.client.DockerClient;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+
+public class SearchDialogTest extends AbstractImageBotTest {
+
+ private static final String IMAGE_NAME = IMAGE_BUSYBOX;
+ private static final String IMAGE_TAG = "1.24";
+ private static final String EXPECTED_IMAGE_NAME = "busybox";
+
+ @Before
+ public void before() {
+ deleteAllConnections();
+ getConnection();
+ deleteImageIfExists(IMAGE_NAME, IMAGE_TAG);
+ if (mockitoIsUsed()) {
+ mockResults();
+ }
+ }
+
+ @Test
+ public void testSearchDialog() {
+ getConnection().openImageSearchDialog(IMAGE_NAME, null, REGISTRY_URL);
+ ImageSearchPage pageOne = new ImageSearchPage();
+ 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 WaitWhile(new ProgressInformationShellIsActive(), TimePeriod.NORMAL);
+ AbstractWait.sleep(TimePeriod.getCustom(5));
+ ImageTagSelectionPage pageTwo = new ImageTagSelectionPage();
+ 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);
+ }
+
+ private void mockResults() {
+ final DockerClient client = MockDockerClientFactory
+ .onSearch(IMAGE_NAME, MockImageSearchResultFactory.name(IMAGE_NAME).build(),
+ MockImageSearchResultFactory.name("other/bar").build())
+ .build();
+ final DockerConnection dockerConnection = MockDockerConnectionFactory.from(DEFAULT_CONNECTION_NAME, client)
+ .withDefaultTCPConnectionSettings();
+ MockDockerConnectionManager.configureConnectionManager(dockerConnection);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/.classpath b/containers/org.eclipse.linuxtools.docker.reddeer/.classpath
new file mode 100644
index 0000000..cf36b56
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/.project b/containers/org.eclipse.linuxtools.docker.reddeer/.project
new file mode 100644
index 0000000..aa317d8
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.linuxtools.docker.reddeer</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.core.resources.prefs b/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.jdt.core.prefs b/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.m2e.core.prefs b/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..f897a7f
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/META-INF/MANIFEST.MF b/containers/org.eclipse.linuxtools.docker.reddeer/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..35cb6d4
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/META-INF/MANIFEST.MF
@@ -0,0 +1,32 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Docker RedDeer
+Bundle-SymbolicName: org.eclipse.linuxtools.docker.reddeer;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.linuxtools.docker.reddeer.Activator
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Red Hat
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.junit,
+ org.eclipse.swt,
+ org.eclipse.ui,
+ org.eclipse.osgi,
+ org.eclipse.core.runtime,
+ org.jboss.reddeer.eclipse;bundle-version="1.2.1",
+ org.jboss.reddeer.common;bundle-version="1.2.1",
+ org.jboss.reddeer.swt;bundle-version="1.2.1",
+ org.jboss.reddeer.core;bundle-version="1.2.1",
+ org.jboss.reddeer.workbench;bundle-version="1.2.1",
+ org.apache.commons.lang;bundle-version="2.6.0",
+ org.eclipse.linuxtools.docker.core,
+ org.hamcrest.library;bundle-version="1.3.0",
+ org.hamcrest.core;bundle-version="1.3.0"
+Export-Package: org.eclipse.linuxtools.docker.reddeer.condition,
+ org.eclipse.linuxtools.docker.reddeer.core.ui.wizards,
+ org.eclipse.linuxtools.docker.reddeer.perspective,
+ org.eclipse.linuxtools.docker.reddeer.preferences,
+ org.eclipse.linuxtools.docker.reddeer.ui,
+ org.eclipse.linuxtools.docker.reddeer.ui.resources,
+ org.eclipse.linuxtools.docker.reddeer.utils,
+ org.eclipse.linuxtools.docker.reddeer
+Import-Package: org.eclipse.linuxtools.internal.docker.ui.testutils
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/about.html b/containers/org.eclipse.linuxtools.docker.reddeer/about.html
new file mode 100644
index 0000000..d93dcd5
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>April 5, 2017</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/build.properties b/containers/org.eclipse.linuxtools.docker.reddeer/build.properties
new file mode 100644
index 0000000..72b6b36
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/build.properties
@@ -0,0 +1,3 @@
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/pom.xml b/containers/org.eclipse.linuxtools.docker.reddeer/pom.xml
new file mode 100644
index 0000000..487cabf
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/pom.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.linuxtools</groupId>
+ <artifactId>org.eclipse.linuxtools.docker</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.linuxtools.docker.reddeer</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <repositories>
+ <repository>
+ <id>reddeer-site</id>
+ <url>http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/1.2.1/</url>
+ <layout>p2</layout>
+ </repository>
+ </repositories>
+</project>
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/Activator.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/Activator.java
new file mode 100644
index 0000000..27e3f1b
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/Activator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat - Initial Contribution
+ *******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class Activator extends Plugin {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.docker.reddeer"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ plugin = null;
+ super.stop(bundleContext);
+ }
+
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static void log(IStatus status) {
+ if (Activator.getDefault() != null && Activator.getDefault().getLog() != null) {
+ Activator.getDefault().getLog().log(status);
+ }
+ }
+
+ public static void logWarningMessage(final String message) {
+ log(new Status(IStatus.WARNING, PLUGIN_ID, IStatus.WARNING, message, null));
+ }
+
+ /**
+ * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=489111
+ */
+ @Deprecated
+ public static void logErrorMessage(final String message) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, null));
+ }
+
+ public static void logErrorMessage(final String message, final Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, e));
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/condition/ContainerIsDeployedCondition.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/condition/ContainerIsDeployedCondition.java
new file mode 100644
index 0000000..f9b0fbb
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/condition/ContainerIsDeployedCondition.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.condition;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection;
+import org.jboss.reddeer.common.condition.AbstractWaitCondition;
+
+/**
+ * @author adietish@redhat.com
+ */
+public class ContainerIsDeployedCondition extends AbstractWaitCondition {
+
+ private String name;
+ private DockerConnection connection;
+
+ public ContainerIsDeployedCondition(String name, DockerConnection connection) {
+ assertNotNull(this.name = name);
+ assertNotNull(this.connection = connection);
+ }
+
+ @Override
+ public boolean test() {
+ connection.refresh();
+ return connection.getContainer(name) != null;
+ }
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/condition/ImageIsDeployedCondition.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/condition/ImageIsDeployedCondition.java
new file mode 100644
index 0000000..b044bd8
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/condition/ImageIsDeployedCondition.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.condition;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection;
+import org.jboss.reddeer.common.condition.AbstractWaitCondition;
+
+/**
+ * @author adietish@redhat.com
+ */
+public class ImageIsDeployedCondition extends AbstractWaitCondition {
+
+ private String name;
+ private DockerConnection connection;
+ private String tag;
+
+ public ImageIsDeployedCondition(String name, DockerConnection connection) {
+ this(name, null, connection);
+ }
+
+ public ImageIsDeployedCondition(String name, String tag, DockerConnection connection) {
+ assertNotNull(this.name = name);
+ assertNotNull(this.connection = connection);
+ this.tag = tag;
+ }
+
+ @Override
+ public boolean test() {
+ if (StringUtils.isBlank(tag)) {
+ return connection.imageIsDeployed(name);
+ } else {
+ return connection.getImage(name, tag) != null;
+ }
+ }
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageRunResourceVolumesVariablesPage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageRunResourceVolumesVariablesPage.java
new file mode 100644
index 0000000..ec55be4
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageRunResourceVolumesVariablesPage.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.core.ui.wizards;
+
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.matcher.WithTextMatcher;
+import org.jboss.reddeer.jface.wizard.WizardPage;
+import org.jboss.reddeer.swt.impl.button.CheckBox;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.button.RadioButton;
+import org.jboss.reddeer.swt.impl.combo.DefaultCombo;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class ImageRunResourceVolumesVariablesPage extends WizardPage {
+
+ public ImageRunResourceVolumesVariablesPage() {
+ super();
+ }
+
+ public void finish() {
+ new FinishButton().click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ }
+
+ public void addDataVolumeNoExternalMount(String containerPath) {
+ new PushButton(0, new WithTextMatcher("Add...")).click();
+ new LabeledText("Container path:").setText(containerPath);
+ new RadioButton("No external mount").click();
+ new OkButton().click();
+ }
+
+ public void addDataVolumeToHost(String containerPath, String path) {
+ addDataVolumeToHost(containerPath, path, false);
+ }
+
+ public void addDataVolumeToHost(String containerPath, String path, boolean readOnly) {
+ new PushButton(0, new WithTextMatcher("Add...")).click();
+ new LabeledText("Container path:").setText(containerPath);
+ new RadioButton("Mount a host directory or host file").click();
+ new LabeledText("Path:").setText(path);
+ new CheckBox("Read-only access").toggle(readOnly);
+ ;
+ new OkButton().click();
+ }
+
+ public void addDataVolumeToContainer(String containerPath, String containerName) {
+ new PushButton(0, new WithTextMatcher("Add...")).click();
+ new LabeledText("Container path:").setText(containerPath);
+ new RadioButton("Mount a data volume container").click();
+ new DefaultCombo("Container").setText(containerName);
+ new OkButton().click();
+ }
+
+ public void addEnviromentVariable(String name, String value) {
+ new PushButton(1, new WithTextMatcher("Add...")).click();
+ new LabeledText("Name:").setText(name);
+ new LabeledText("Value:").setText(value);
+ new OkButton().click();
+ }
+
+ public void addLabel(String name, String value) {
+ new PushButton(2, new WithTextMatcher("Add...")).click();
+ new LabeledText("Name:").setText(name);
+ new LabeledText("Value:").setText(value);
+ new OkButton().click();
+ }
+
+ public void setResourceLimitation(String CPU, String memoryLimit) {
+ new CheckBox("Enable resource limitations").click();
+
+ switch (CPU) {
+ case "Low":
+ new RadioButton("Low").click();
+ break;
+ case "Medium":
+ new RadioButton("Medium").click();
+ break;
+ case "High":
+ new RadioButton("High").click();
+ break;
+ default:
+ new RadioButton("Medium").click();
+ }
+
+ new LabeledText("Memory limit:").setText(memoryLimit);
+ }
+
+ public void setEntrypoint(String Entrypoint) {
+ new LabeledText("Entrypoint:").setText(Entrypoint);
+ }
+
+ public void setCommand(String command) {
+ new LabeledText("Command:").setText(command);
+ }
+
+ public void setPublishAllExposedPorts() {
+ new CheckBox("Publish all exposed ports to random ports on the host interfaces").click();
+ }
+
+ public void setKeepSTDINOpen() {
+ new CheckBox("Keep STDIN open to Console even if not attached (-i)").click();
+ }
+
+ public void setAllocatePseudoTTY() {
+ new CheckBox("Allocate pseudo-TTY from Console (-t)").click();
+ }
+
+ public void setAutomaticalyRemove() {
+ new CheckBox("Automatically remove the container when it exits (--rm)").click();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageRunSelectionPage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageRunSelectionPage.java
new file mode 100644
index 0000000..7c5f06b
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageRunSelectionPage.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.core.ui.wizards;
+
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.core.matcher.WithTextMatcher;
+import org.jboss.reddeer.jface.wizard.WizardPage;
+import org.jboss.reddeer.swt.impl.button.CheckBox;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.button.NextButton;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.combo.LabeledCombo;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class ImageRunSelectionPage extends WizardPage {
+
+ public ImageRunSelectionPage() {
+ super();
+ new WaitUntil(new ShellWithTextIsAvailable("Run a Docker Image"), TimePeriod.LONG);
+ }
+
+ public void finish() {
+ if (new FinishButton().isEnabled()) {
+ new FinishButton().click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ } else {
+ throw new RuntimeException("Image cannot be run! (Duplicate name?)");
+ }
+ }
+
+ public void next() {
+ new NextButton().click();
+ }
+
+ public void setContainerName(String name) {
+ new LabeledText("Container Name:").setText(name);
+ }
+
+ public void setEntrypoint(String Entrypoint) {
+ new LabeledText("Entrypoint:").setText(Entrypoint);
+ }
+
+ public void setCommand(String command) {
+ new LabeledText("Command:").setText(command);
+ }
+
+ public void setPublishAllExposedPorts(boolean checked) {
+ new CheckBox("Publish all exposed ports to random ports on the host interfaces").toggle(checked);
+ }
+
+ public void setPublishAllExposedPorts() {
+ setPublishAllExposedPorts(true);
+ }
+
+ public void setKeepSTDINOpen(boolean checked) {
+ new CheckBox("Keep STDIN open to Console even if not attached (-i)").toggle(checked);
+ }
+
+ public void setKeepSTDINOpen() {
+ setKeepSTDINOpen(true);
+ }
+
+ public void setAllocatePseudoTTY(boolean checked) {
+ new CheckBox("Allocate pseudo-TTY from Console (-t)").toggle(checked);
+ }
+
+ public void setAllocatePseudoTTY() {
+ setAllocatePseudoTTY(true);
+ }
+
+ public void setAutomaticalyRemove(boolean checked) {
+ new CheckBox("Automatically remove the container when it exits (--rm)").toggle(checked);
+ }
+
+ public void setAutomaticalyRemove() {
+ setAutomaticalyRemove(true);
+ }
+
+ public void setGiveExtendedPrivileges(boolean checked) {
+ new CheckBox("Give extended privileges to this container (--privileged)").toggle(checked);
+ }
+
+ public void setGiveExtendedPrivileges() {
+ setGiveExtendedPrivileges(true);
+ }
+
+ public void addExposedPort(String containerPort, String hostAddress, String hostPort) {
+ new PushButton(0, new WithTextMatcher("Add...")).click();
+ new DefaultShell("Exposing a Container Port");
+ new LabeledText("Container port:").setText(containerPort);
+ new LabeledText("Host address:").setText(hostAddress);
+ new LabeledText("Host port:").setText(hostPort);
+ new OkButton().click();
+ }
+
+ public void addLinkToContainer(String containerName, String alias) {
+ new PushButton(1, new WithTextMatcher("Add...")).click();
+ new DefaultShell("Container Linking");
+ new LabeledCombo("Container:").setText(containerName);
+ new LabeledText("Alias:").setText(alias);
+ new OkButton().click();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageSearchPage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageSearchPage.java
new file mode 100644
index 0000000..cb8bdf6
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageSearchPage.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.core.ui.wizards;
+
+import java.util.List;
+
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.jface.wizard.WizardPage;
+import org.jboss.reddeer.swt.api.TableItem;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.button.NextButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.swt.impl.table.DefaultTable;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class ImageSearchPage extends WizardPage {
+
+ public ImageSearchPage() {
+ super();
+ new DefaultShell("Search and pull a Docker image");
+ }
+
+ public void finish() {
+ new FinishButton().click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ }
+
+ public void searchImage(String imageName) {
+ new LabeledText("Image:").setText(imageName);
+ new PushButton("Search").click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+ }
+
+ public void searchImage() {
+ new PushButton("Search").click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+ }
+
+ public List<TableItem> getSearchResults() {
+ return new DefaultTable().getItems();
+ }
+
+ public boolean searchResultsContains(String imageName) {
+ for (TableItem item : getSearchResults()) {
+ if (imageName.contains(item.getText())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void next() {
+ new NextButton().click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+ }
+
+ public void selectImage(String imageName) {
+ for (TableItem item : getSearchResults()) {
+ if (imageName.contains(item.getText())) {
+ item.select();
+ }
+ }
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageTagSelectionPage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageTagSelectionPage.java
new file mode 100644
index 0000000..a41d2f1
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/ImageTagSelectionPage.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.core.ui.wizards;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+import java.util.List;
+
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.jface.wizard.WizardPage;
+import org.jboss.reddeer.swt.api.TableItem;
+import org.jboss.reddeer.swt.impl.button.CancelButton;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.table.DefaultTable;
+
+public class ImageTagSelectionPage extends WizardPage {
+
+ public ImageTagSelectionPage() {
+ super();
+ new WaitUntil(new ShellWithTextIsAvailable("Search and pull a Docker image"), TimePeriod.NORMAL);
+ }
+
+ public void finish() {
+ new FinishButton().click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ }
+
+ public List<TableItem> getTags() {
+ return new DefaultTable().getItems();
+ }
+
+ public boolean tagsContains(String tagName) {
+ for (TableItem item : getTags()) {
+ if (tagName.equals(item.getText())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void selectTag(String tag) {
+ for (TableItem item : getTags()) {
+ if (tag.contains(item.getText())) {
+ item.select();
+ }
+ }
+ }
+
+ public void cancel() {
+ new CancelButton().click();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/NewDockerConnectionPage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/NewDockerConnectionPage.java
new file mode 100644
index 0000000..c32b632
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/core/ui/wizards/NewDockerConnectionPage.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.core.ui.wizards;
+
+import org.eclipse.linuxtools.docker.reddeer.ui.DockerExplorerView;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.jface.wizard.WizardPage;
+import org.jboss.reddeer.swt.api.Button;
+import org.jboss.reddeer.swt.api.Table;
+import org.jboss.reddeer.swt.condition.WidgetIsEnabled;
+import org.jboss.reddeer.swt.impl.button.CheckBox;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.button.RadioButton;
+import org.jboss.reddeer.swt.impl.table.DefaultTable;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+import org.jboss.reddeer.swt.impl.toolbar.DefaultToolItem;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+public class NewDockerConnectionPage extends WizardPage {
+ private static final String NEW_DOCKER_CONNECTION_SHELL = "New Docker Connection";
+
+ public NewDockerConnectionPage() {
+ super();
+ }
+
+ public void open() {
+ new DockerExplorerView().open();
+ new DefaultToolItem("Add Connection").click();
+ new WaitUntil(new ShellWithTextIsAvailable(NEW_DOCKER_CONNECTION_SHELL));
+ }
+
+ public void finish() {
+ new WaitUntil(new ShellWithTextIsAvailable(NEW_DOCKER_CONNECTION_SHELL));
+ new WaitUntil(new WidgetIsEnabled(new FinishButton()));
+ new FinishButton().click();
+
+ new WaitWhile(new ShellWithTextIsAvailable(NEW_DOCKER_CONNECTION_SHELL), TimePeriod.LONG);
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ }
+
+ public void setConnectionName(String name) {
+ new LabeledText("Connection name:").setText(name);
+ }
+
+ public void setUnixSocket(String unixSocket) {
+ new CheckBox("Use custom connection settings:").toggle(true);
+ new LabeledText("Location:").setText(unixSocket);
+ }
+
+ public void setTcpConnection(String uri) {
+ setTcpConnection(uri, null, false);
+ }
+
+ public void setTcpConnection(String uri, String authentificationCertificatePath, boolean pingConnection) {
+ setTcpUri(uri);
+ if (authentificationCertificatePath != null) {
+ new CheckBox("Enable authentication").toggle(true);
+ new LabeledText("Path:").setText(authentificationCertificatePath);
+ }
+ if (pingConnection) {
+ pingConnection();
+ }
+ }
+
+ public void setTcpUri(String uri) {
+ setConnectionName(uri);
+ new CheckBox("Use custom connection settings:").toggle(true);
+ new LabeledText("Location:").setText("");
+ new RadioButton("TCP Connection").toggle(true);
+ new LabeledText("URI:").setText(uri);
+ }
+
+ public void pingConnection() {
+ Button testConnectionButton = new PushButton("Test Connection");
+ testConnectionButton.click();
+ new WaitUntil(new ShellWithTextIsAvailable("Success"));
+ new OkButton().click();
+ }
+
+ public void search(String connectionName) {
+ new PushButton("Search...").click();
+ new WaitUntil(new ShellWithTextIsAvailable("Docker Connection Selection"));
+ Table table = new DefaultTable();
+ table.getItem(connectionName).select();
+ new OkButton().click();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/perspective/DockerPerspective.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/perspective/DockerPerspective.java
new file mode 100644
index 0000000..990472f
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/perspective/DockerPerspective.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.perspective;
+
+import org.jboss.reddeer.eclipse.ui.perspectives.AbstractPerspective;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class DockerPerspective extends AbstractPerspective {
+
+ public DockerPerspective() {
+ super("Docker Tooling");
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerComposePreferencePage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerComposePreferencePage.java
new file mode 100644
index 0000000..6906653
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerComposePreferencePage.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.preferences;
+
+import org.jboss.reddeer.jface.preference.PreferencePage;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+
+/**
+ *
+ *
+ * @author jkopriva@redhat.com
+ */
+
+public class DockerComposePreferencePage extends PreferencePage {
+
+ public DockerComposePreferencePage() {
+ super("Docker", "Docker Compose");
+ }
+
+ public void setPathToDockerCompose(String path) {
+ new LabeledText("Docker Compose ").setText(path);
+ }
+
+ public String getPathToDockerCompose() {
+ return new LabeledText("Docker Compose ").getText();
+ }
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerMachinePreferencePage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerMachinePreferencePage.java
new file mode 100644
index 0000000..c412feb
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerMachinePreferencePage.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.preferences;
+
+import org.jboss.reddeer.jface.preference.PreferencePage;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+
+/**
+ *
+ *
+ * @author jkopriva@redhat.com
+ */
+
+public class DockerMachinePreferencePage extends PreferencePage {
+
+ public DockerMachinePreferencePage() {
+ super("Docker", "Docker Machine");
+ }
+
+ public void setDockerMachine(String pathToDockerMachine) {
+ new LabeledText("Docker Machine").setText(pathToDockerMachine);
+ }
+
+ public void setVMDriver(String pathToVMDriver) {
+ new LabeledText("VM Driver").setText(pathToVMDriver);
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerPreferencePage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerPreferencePage.java
new file mode 100644
index 0000000..a68b906
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/DockerPreferencePage.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.preferences;
+
+import org.jboss.reddeer.jface.preference.PreferencePage;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+
+/**
+ *
+ *
+ * @author jkopriva@redhat.com
+ */
+
+public class DockerPreferencePage extends PreferencePage {
+
+ public DockerPreferencePage() {
+ super("Docker");
+ }
+
+ public void setContainerRefreshRate(int seconds) {
+ new LabeledText("Container Refresh Rate (seconds)").setText(String.valueOf(seconds));
+ }
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/LoggingPreferencePage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/LoggingPreferencePage.java
new file mode 100644
index 0000000..306f1b6
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/LoggingPreferencePage.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.preferences;
+
+import org.jboss.reddeer.jface.preference.PreferencePage;
+import org.jboss.reddeer.swt.impl.button.CheckBox;
+
+/**
+ *
+ *
+ * @author jkopriva@redhat.com
+ */
+
+public class LoggingPreferencePage extends PreferencePage {
+
+ public LoggingPreferencePage() {
+ super("Docker", "Docker Machine");
+ }
+
+ public void setAutomaticallyLog(boolean toggle) {
+ CheckBox cb = new CheckBox("Automatically log when Container starts");
+ cb.toggle(toggle);
+ }
+
+ public void setAutomaticallyLog() {
+ setAutomaticallyLog(true);
+ }
+
+ public void setRequestTimestamp(boolean toggle) {
+ CheckBox cb = new CheckBox("Request time stamp for logs");
+ cb.toggle(toggle);
+ }
+
+ public void setRequestTimestamp() {
+ setRequestTimestamp(true);
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/RegistryAccountsPreferencePage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/RegistryAccountsPreferencePage.java
new file mode 100644
index 0000000..b680607
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/preferences/RegistryAccountsPreferencePage.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.preferences;
+
+import org.jboss.reddeer.jface.preference.PreferencePage;
+import org.jboss.reddeer.swt.api.Table;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.table.DefaultTable;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class RegistryAccountsPreferencePage extends PreferencePage {
+
+ public static final String SERVER_ADDRESS = "Server Address:";
+ public static final String USERNAME = "Username:";
+ public static final String EMAIL = "Email:";
+ public static final String PASSWORD = "Password:";
+
+ public RegistryAccountsPreferencePage() {
+ super("Docker", "Registry Accounts");
+ }
+
+ public void addRegistry(String serverAddress, String email, String userName, String password) {
+ new PushButton("Add").click();
+ new LabeledText(SERVER_ADDRESS).setText(serverAddress);
+ new LabeledText(USERNAME).setText(userName);
+ new LabeledText(EMAIL).setText(email);
+ new LabeledText(PASSWORD).setText(password);
+ new OkButton().click();
+ }
+
+ public void editRegistry(String serverAddress, String email, String userName, String password) {
+ Table table = new DefaultTable();
+ if (table.containsItem(serverAddress)) {
+ table.select(serverAddress);
+ new PushButton("Edit").click();
+ new LabeledText(SERVER_ADDRESS).setText(serverAddress);
+ new LabeledText(USERNAME).setText(userName);
+ new LabeledText(EMAIL).setText(email);
+ new LabeledText(PASSWORD).setText(password);
+ new PushButton("OK").click();
+ }
+ }
+
+ public void removeRegistry(String serverAddress) {
+ Table table = new DefaultTable();
+ if (table.containsItem(serverAddress)) {
+ table.select(serverAddress);
+ new PushButton("Remove").click();
+ }
+ }
+
+ public void removeAllRegistries() {
+ Table table = new DefaultTable();
+ for (int i = 0; i < table.rowCount(); i++) {
+ table.select(0);
+ new PushButton("Remove").click();
+ }
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/AbstractDockerExplorerItem.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/AbstractDockerExplorerItem.java
new file mode 100644
index 0000000..306a578
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/AbstractDockerExplorerItem.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui;
+
+import org.jboss.reddeer.jface.viewer.handler.TreeViewerHandler;
+import org.jboss.reddeer.swt.api.TreeItem;
+
+/**
+ *
+ * @author jkopriva@redhat.com, mlabuda@redhat.com
+ *
+ */
+
+public abstract class AbstractDockerExplorerItem {
+
+ protected TreeViewerHandler treeViewerHandler = TreeViewerHandler.getInstance();
+ protected TreeItem item;
+
+ public AbstractDockerExplorerItem(TreeItem treeItem) {
+ this.item = treeItem;
+ }
+
+ /**
+ * Activates docker explorer.
+ */
+ protected void activateDockerExplorerView() {
+ new DockerExplorerView().activate();
+ }
+
+ /**
+ * Selects abstract docker explorer item.
+ */
+ public void select() {
+ activateDockerExplorerView();
+ item.select();
+ }
+
+ /**
+ * Gets tree item encapsulated in abstract docker explorer item.
+ *
+ * @return encapsulated tree item
+ */
+ public TreeItem getTreeItem() {
+ return item;
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerContainersTab.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerContainersTab.java
new file mode 100644
index 0000000..c60024c
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerContainersTab.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui;
+
+import java.util.List;
+
+import org.jboss.reddeer.eclipse.exception.EclipseLayerException;
+import org.jboss.reddeer.swt.api.TableItem;
+import org.jboss.reddeer.swt.impl.table.DefaultTable;
+import org.jboss.reddeer.swt.impl.text.DefaultText;
+import org.jboss.reddeer.swt.impl.toolbar.DefaultToolItem;
+import org.jboss.reddeer.workbench.impl.view.WorkbenchView;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class DockerContainersTab extends WorkbenchView {
+
+ public DockerContainersTab() {
+ super("Docker Containers");
+ }
+
+ public TableItem getDockerContainer(String dockerContainerName) {
+ this.activate();
+ for (TableItem item : getTableItems()) {
+ if (item.getText().equals(dockerContainerName)) {
+ return item;
+ }
+ }
+ throw new EclipseLayerException("There is no container with name " + dockerContainerName);
+ }
+
+ public void refresh() {
+ this.activate();
+ new DefaultToolItem("Refresh (F5)").click();
+
+ }
+
+ public List<TableItem> getTableItems() {
+ return new DefaultTable().getItems();
+
+ }
+
+ public void select(String containerName) {
+ getDockerContainer(containerName).select();
+ }
+
+ public void searchContainer(String containerName) {
+ this.activate();
+ new DefaultText().setText(containerName);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerExplorerView.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerExplorerView.java
new file mode 100644
index 0000000..dc7601a
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerExplorerView.java
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.linuxtools.docker.core.DockerConnectionManager;
+import org.eclipse.linuxtools.docker.core.IDockerConnection;
+import org.eclipse.linuxtools.docker.core.IDockerConnectionStorageManager;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.NewDockerConnectionPage;
+import org.eclipse.linuxtools.docker.reddeer.ui.resources.AuthenticationMethod;
+import org.eclipse.linuxtools.docker.reddeer.ui.resources.DockerConnection;
+import org.eclipse.linuxtools.internal.docker.ui.testutils.MockDockerConnectionStorageManagerFactory;
+import org.jboss.reddeer.core.exception.CoreLayerException;
+import org.jboss.reddeer.jface.exception.JFaceLayerException;
+import org.jboss.reddeer.jface.viewer.handler.TreeViewerHandler;
+import org.jboss.reddeer.swt.api.TreeItem;
+import org.jboss.reddeer.swt.impl.tree.DefaultTree;
+import org.jboss.reddeer.workbench.impl.view.WorkbenchView;
+
+/**
+ *
+ * @author jkopriva@redhat.com, mlabuda@redhat.com
+ * @contributor adietish@redhat.com
+ *
+ */
+public class DockerExplorerView extends WorkbenchView {
+
+ public static final String SCHEME_TERMINATOR = "://";
+ public static final String SCHEME_TCP = "tcp";
+ public static final String SCHEME_HTTP = "http";
+ private TreeViewerHandler treeViewerHandler = TreeViewerHandler.getInstance();
+
+ public DockerExplorerView() {
+ super("Docker", "Docker Explorer");
+ }
+
+ /**
+ * Gets names of all docker connections present in docker explorer.
+ *
+ * @return list of docker connections names
+ */
+ public List<String> getDockerConnectionNames() {
+ activate();
+ List<String> connectionsNames = new ArrayList<String>();
+ try {
+ List<TreeItem> connections = new DefaultTree().getItems();
+ for (TreeItem item : connections) {
+ connectionsNames.add(getName(item));
+ }
+ } catch (CoreLayerException ex) {
+ // no connections in view
+ }
+ return connectionsNames;
+ }
+
+ private String getName(TreeItem item) {
+ return treeViewerHandler.getNonStyledText(item);
+ }
+
+ private String getHost(TreeItem item) {
+ String[] styledTexts = treeViewerHandler.getStyledTexts(item);
+ if (styledTexts == null || styledTexts.length == 0) {
+ return null;
+ }
+ return styledTexts[0].replaceAll("[\\(\\)]", "");
+ }
+
+ public boolean connectionExistForName(String connectionName) {
+ return getDockerConnectionByName(connectionName) != null;
+ }
+
+ public boolean connectionExistForHost(String host) {
+ return getDockerConnectionByHost(host) != null;
+ }
+
+ public void refreshView() {
+ List<String> connections = getDockerConnectionNames();
+ for (String connection : connections) {
+ getDockerConnectionByName(connection).refresh();
+ }
+ }
+
+ /**
+ * Creates a docker connection connected to a docker daemon through Search
+ * Connection socket with name "default".
+ *
+ */
+ public void createDockerConnectionSearch(String connectionName) {
+ activate();
+ NewDockerConnectionPage connectionWizard = new NewDockerConnectionPage();
+ connectionWizard.open();
+ connectionWizard.search(connectionName);
+ connectionWizard.finish();
+ }
+
+ /**
+ * Creates a docker connection connected to a docker daemon through unix
+ * socket with name "default".
+ *
+ * @param unixSocket
+ * unix socket of a docker daemon
+ */
+ public void createDockerConnectionUnix(String connectionName, String unixSocket) {
+ createDockerConnection(AuthenticationMethod.UNIX_SOCKET, unixSocket, null, connectionName);
+ }
+
+ /**
+ * Creates a docker connection connected with IDockerConnection.
+ * (used with mockito)
+ *
+ * @param connections
+ * IDockerConnections
+ */
+
+ public void createDockerConnectionUnix(final IDockerConnection... connections) {
+ final IDockerConnectionStorageManager connectionStorageManager = MockDockerConnectionStorageManagerFactory
+ .providing(connections);
+ DockerConnectionManager.getInstance().setConnectionStorageManager(connectionStorageManager);
+ }
+
+ /**
+ * Creates a docker connection connected to a docker daemon through TCP with
+ * name "default".
+ *
+ * @param tcpURI
+ * TCP URI
+ * @param certificatePath
+ * path to a certificate
+ */
+ public void createDockerConnectionURI(String connectionName, String tcpURI, String certificatePath) {
+ createDockerConnection(AuthenticationMethod.TCP_CONNECTION, tcpURI, certificatePath, connectionName);
+ }
+
+ /**
+ * Creates a docker connection connected to a docker daemon through TCP or
+ * unix socket with a specified name.
+ *
+ * @param authMethod
+ * unix socket or TCP URI
+ * @param unixSocketOrTcpURI
+ * unix socket path or TCP URI
+ * @param certificatePath
+ * path to a certificate if exists
+ * @param connectionName
+ * docker connection name
+ */
+ public void createDockerConnection(AuthenticationMethod authMethod, String unixSocketOrTcpURI,
+ String authentificationCertificatePath, String connectionName) {
+
+ activate();
+ NewDockerConnectionPage connectionWizard = new NewDockerConnectionPage();
+ connectionWizard.open();
+ connectionWizard.setConnectionName(connectionName);
+ if (AuthenticationMethod.TCP_CONNECTION.equals(authMethod)) {
+ connectionWizard.setTcpConnection(unixSocketOrTcpURI, authentificationCertificatePath, false);
+ } else if (AuthenticationMethod.UNIX_SOCKET.equals(authMethod)) {
+ connectionWizard.setUnixSocket(unixSocketOrTcpURI);
+ }
+ connectionWizard.finish();
+ }
+
+ /**
+ * Gets docker connection with specific name or null if does not exists.
+ *
+ * @return DockerConnection with specific name or null if does not exist.
+ */
+ public DockerConnection getDockerConnectionByName(String connectionName) {
+ activate();
+ try {
+ return new DockerConnection(treeViewerHandler.getTreeItem(new DefaultTree(), connectionName));
+ } catch (JFaceLayerException ex) {
+ return null;
+ }
+ }
+
+ public DockerConnection getDockerConnectionByHost(String host) {
+ activate();
+ try {
+ List<TreeItem> connections = new DefaultTree().getItems();
+ for (TreeItem item : connections) {
+ if (equalHosts(host, getHost(item))) {
+ return new DockerConnection(item);
+ }
+ }
+ } catch (CoreLayerException ex) {
+ // no connections in view
+ }
+ return null;
+ }
+
+ /**
+ * Returns {@code true} if the 2 given hosts are equal. TCP and HTTP schemes
+ * are considered as equivalent.
+ *
+ * @param host1
+ * @param host2
+ * @return returns true if the host1 is equal to host2
+ */
+ private boolean equalHosts(String host1, String host2) {
+ if (host1 == null) {
+ return host2 == null;
+ }
+
+ if (host1.equals(host2)) {
+ return true;
+ }
+
+ int schemeIndex1 = host1.indexOf(':');
+ if (schemeIndex1 >= 0) {
+ int schemeIndex2 = host2.indexOf(SCHEME_TERMINATOR);
+ if (schemeIndex2 >= 0) {
+ String scheme1 = host1.substring(0, schemeIndex1);
+ String scheme2 = host2.substring(0, schemeIndex2);
+ if ((SCHEME_HTTP.equals(scheme1) || SCHEME_TCP.equals(scheme1))
+ && (SCHEME_HTTP.equals(scheme2) || SCHEME_TCP.equals(scheme2))) {
+ String hostAddr1 = host1.substring(schemeIndex1 + SCHEME_TERMINATOR.length(), host1.length());
+ String hostAddr2 = host2.substring(schemeIndex2 + SCHEME_TERMINATOR.length(), host2.length());
+ return hostAddr1.equals(hostAddr2);
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerImageHierarchyTab.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerImageHierarchyTab.java
new file mode 100644
index 0000000..f6dc7c2
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerImageHierarchyTab.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui;
+
+import java.util.List;
+
+import org.jboss.reddeer.eclipse.exception.EclipseLayerException;
+import org.jboss.reddeer.swt.api.TreeItem;
+import org.jboss.reddeer.swt.impl.tree.DefaultTree;
+import org.jboss.reddeer.workbench.impl.view.WorkbenchView;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class DockerImageHierarchyTab extends WorkbenchView {
+
+ public DockerImageHierarchyTab() {
+ super("Docker Image Hierarchy");
+ }
+
+ public TreeItem getDockerImage(String dockerImageName) {
+ activate();
+ for (TreeItem item : getTreeItems()) {
+ if (item.getText().contains(dockerImageName)) {
+ return item;
+ }
+ }
+ throw new EclipseLayerException("There is no Docker image with name " + dockerImageName);
+ }
+
+ public List<TreeItem> getTreeItems() {
+ activate();
+ return new DefaultTree().getItems();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerImagesTab.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerImagesTab.java
new file mode 100644
index 0000000..3f98143
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerImagesTab.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui;
+
+import java.util.List;
+
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.eclipse.exception.EclipseLayerException;
+import org.jboss.reddeer.swt.api.Combo;
+import org.jboss.reddeer.swt.api.TableItem;
+import org.jboss.reddeer.swt.impl.button.CheckBox;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.combo.DefaultCombo;
+import org.jboss.reddeer.swt.impl.menu.ContextMenu;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.swt.impl.table.DefaultTable;
+import org.jboss.reddeer.swt.impl.text.DefaultText;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+import org.jboss.reddeer.swt.impl.toolbar.DefaultToolItem;
+import org.jboss.reddeer.workbench.impl.view.WorkbenchView;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class DockerImagesTab extends WorkbenchView {
+
+ public DockerImagesTab() {
+ super("Docker Images");
+ }
+
+ public TableItem getDockerImage(String dockerImageName) {
+ activate();
+ for (TableItem item : getTableItems()) {
+ if (item.getText(1).contains(dockerImageName)) {
+ return item;
+ }
+ }
+ throw new EclipseLayerException("There is no Docker image with name " + dockerImageName);
+ }
+
+ public void refresh() {
+ activate();
+ new DefaultToolItem("Refresh (F5)").click();
+
+ }
+
+ public List<TableItem> getTableItems() {
+ activate();
+ return new DefaultTable().getItems();
+
+ }
+
+ public void buildImage(String name, String directory) {
+ activate();
+ new DefaultToolItem("Build Image").click();
+ new WaitUntil(new ShellWithTextIsAvailable(""));
+ new LabeledText("Image Name:").setText(name);
+ new LabeledText("Directory:").setText(directory);
+ new FinishButton().click();
+ }
+
+ public void runImage(String imageName) {
+ activate();
+ selectImage(imageName);
+ new ContextMenu("Run...").select();
+ }
+
+ public String getImageTags(String imageName) {
+ activate();
+ TableItem image = getDockerImage(imageName);
+ return image.getText(1);
+ }
+
+ public void addTagToImage(String imageName, String newTag) {
+ selectImage(imageName);
+ new ContextMenu("Add Tag").select();
+ new DefaultShell("Tag Image");
+ new LabeledText("New Tag:").setText(newTag);
+ new FinishButton().click();
+ }
+
+ public void removeTagFromImage(String imageName, String tagToBeRemoved) {
+ selectImage(imageName);
+ new ContextMenu("Remove Tag").select();
+ String fullTag = "";
+ Combo combo = new DefaultCombo();
+ List<String> comboItems = combo.getItems();
+ for (String item : comboItems) {
+ if (item.contains(tagToBeRemoved)) {
+ fullTag = item;
+ break;
+ }
+ }
+ combo.setSelection(fullTag);
+ new FinishButton().click();
+ }
+
+ public void selectImage(String imageName) {
+ activate();
+ TableItem image = getDockerImage(imageName);
+ image.select();
+ }
+
+ public void pushImage(String imageName, String registryAccount, boolean forceTagging, boolean keepTaggedImage) {
+ selectImage(imageName);
+ new ContextMenu("Push...").select();
+ Combo combo = new DefaultCombo();
+ combo.setSelection(registryAccount);
+ new CheckBox("Force tagging image with selected registry").toggle(forceTagging);
+ new CheckBox("Keep tagged image upon completion").toggle(keepTaggedImage);
+ new FinishButton().click();
+ }
+
+ public void searchImage(String searchText) {
+ this.activate();
+ new DefaultText().setText(searchText);
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerTerminal.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerTerminal.java
new file mode 100644
index 0000000..fe2d595
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/DockerTerminal.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui;
+
+import org.jboss.reddeer.swt.impl.ctab.DefaultCTabFolder;
+import org.jboss.reddeer.workbench.impl.view.WorkbenchView;
+import org.jboss.reddeer.swt.api.CTabFolder;
+import org.jboss.reddeer.swt.api.CTabItem;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class DockerTerminal extends WorkbenchView {
+
+ public DockerTerminal() {
+ super("Terminal");
+ }
+
+ public CTabItem getPage(String pageLabel) {
+ CTabFolder tabFolder = new DefaultCTabFolder();
+ CTabItem tabItem = tabFolder.getSelection();
+ tabItem.activate();
+ return tabItem;
+ }
+
+ public String getTextFromPage(String tabName) {
+ return getPage(tabName).getText();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/RunDockerImageLaunchConfiguration.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/RunDockerImageLaunchConfiguration.java
new file mode 100644
index 0000000..ff470af
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/RunDockerImageLaunchConfiguration.java
@@ -0,0 +1,392 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageSearchPage;
+import org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageTagSelectionPage;
+import org.eclipse.linuxtools.docker.reddeer.perspective.DockerPerspective;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.condition.ProgressInformationShellIsActive;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.eclipse.debug.ui.launchConfigurations.LaunchConfiguration;
+import org.jboss.reddeer.eclipse.exception.EclipseLayerException;
+import org.jboss.reddeer.swt.api.Table;
+import org.jboss.reddeer.swt.impl.button.CheckBox;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.button.RadioButton;
+import org.jboss.reddeer.swt.impl.combo.DefaultCombo;
+import org.jboss.reddeer.swt.impl.combo.LabeledCombo;
+import org.jboss.reddeer.swt.impl.ctab.DefaultCTabItem;
+import org.jboss.reddeer.swt.impl.menu.ShellMenu;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.swt.impl.table.DefaultTable;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+import org.jboss.reddeer.swt.impl.toolbar.DefaultToolItem;
+import org.jboss.reddeer.swt.impl.tree.DefaultTreeItem;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class RunDockerImageLaunchConfiguration extends LaunchConfiguration {
+
+ private static final String MAIN_TAB_LABEL = "Main";
+ private static final String VOLUMES_TAB_LABEL = "Volumes";
+ private static final String PORTS_TAB_LABEL = "Ports";
+ private static final String LINKS_TAB_LABEL = "Links";
+ private static final String ENVIRONMENT_TAB_LABEL = "Environment";
+ private static final String LABELS_TAB_LABEL = "Labels";
+ private static final String RESOURCES_TAB_LABEL = "Resources";
+ private static final String DELETE_LAUNCH_CONFIGURATION_LABEL = "Delete selected launch configuration(s)";
+
+ public RunDockerImageLaunchConfiguration() {
+ super("Run Docker Image");
+ }
+
+ /**
+ * Opens Run configuration dialog
+ */
+ public void open() {
+ DockerPerspective p = new DockerPerspective();
+ p.open();
+ new ShellMenu("Run", "Run Configurations...").select();
+ new WaitUntil(new ShellWithTextIsAvailable("Run Configurations"));
+ }
+
+ /**
+ * Creates new Docker launch configuration
+ */
+ public void createNewConfiguration(String configurationName) {
+ new DefaultTreeItem("Run Docker Image").select();
+ new DefaultToolItem("New launch configuration").click();
+ setName(configurationName);
+ }
+
+ /**
+ * Select configuration name
+ *
+ * @param confName
+ * configuration name
+ */
+ public void selectConfiguration(String confName) {
+ new DefaultTreeItem("Run Docker Image", confName).select();
+ }
+
+ private void addValueInTable(String tabName, String shellName, String newValueName, String newValue) {
+ selectTab(tabName);
+ new PushButton("Add...").click();
+ new WaitUntil(new ShellWithTextIsAvailable(shellName));
+ new LabeledText("Name:").setText(newValueName);
+ new LabeledText("Value:").setText(newValue);
+ new OkButton().click();
+ }
+
+ private void editValueInTable(String tabName, String shellName, String oldValueName, String newValueName,
+ String newValue) {
+ selectTab(tabName);
+ if (selectItemInTable(oldValueName)) {
+ new PushButton("Edit...");
+ new WaitWhile(new ShellWithTextIsAvailable(shellName));
+ new LabeledText("Name:").setText(newValueName);
+ new LabeledText("Value:").setText(newValue);
+ new OkButton().click();
+ } else {
+ throw new EclipseLayerException("There is no " + oldValueName + " in table on tab " + tabName);
+ }
+ }
+
+ private void removeValueInTable(String tabName, String valueName) {
+ selectTab(LABELS_TAB_LABEL);
+ if (selectItemInTable(valueName)) {
+ new PushButton("Remove").click();
+ } else {
+ throw new EclipseLayerException("There is no " + valueName + " in table on tab " + tabName);
+ }
+ }
+
+ public void setConfigurationName(String configurationName) {
+ selectTab(MAIN_TAB_LABEL);
+ new LabeledText("Name:").setText(configurationName);
+ }
+
+ // Main tab
+ public void selectConnection(String connectionName) {
+ selectTab(MAIN_TAB_LABEL);
+ new LabeledCombo("Connection:").setSelection(connectionName);
+ }
+
+ public void selectImage(String imageName) {
+ selectTab(MAIN_TAB_LABEL);
+ new LabeledCombo("Image:").setSelection(imageName);
+ }
+
+ public void searchImage(String imageName, String tag) {
+ selectTab(MAIN_TAB_LABEL);
+ new PushButton("Search...");
+ ImageSearchPage pageOne = new ImageSearchPage();
+ pageOne.searchImage(imageName);
+ pageOne.next();
+ new WaitWhile(new ProgressInformationShellIsActive(), TimePeriod.NORMAL);
+ ImageTagSelectionPage pageTwo = new ImageTagSelectionPage();
+ assertFalse("Search tags are empty!", pageTwo.getTags().isEmpty());
+ new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL);
+ assertTrue("Search results do not contains tag:" + tag + "!", pageTwo.tagsContains(tag));
+ pageTwo.selectTag(tag);
+ pageTwo.finish();
+ new DefaultShell("Pull Image");
+ new PushButton("Finish").click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ }
+
+ public void setContainerName(String containerName) {
+ selectTab(MAIN_TAB_LABEL);
+ new LabeledText("Container Name:").setText(containerName);
+ }
+
+ public void setEntrypoint(String entrypoint) {
+ selectTab(MAIN_TAB_LABEL);
+ new LabeledText("Entrypoint:").setText(entrypoint);
+ }
+
+ public void setCommand(String command) {
+ selectTab(MAIN_TAB_LABEL);
+ new LabeledText("Command:").setText(command);
+ }
+
+ public void setKeepSTDINopentoConsoleevenifnotattachedi(boolean checked) {
+ selectTab(MAIN_TAB_LABEL);
+ new CheckBox("Keep STDIN open to Console even if not attached (-i)").toggle(checked);
+ }
+
+ public void setAllocatepseudoTTYfromConsolet(boolean checked) {
+ selectTab(MAIN_TAB_LABEL);
+ new CheckBox("Allocate pseudo-TTY from Console (-t)").toggle(checked);
+ }
+
+ public void setRemoveContainerOnExit(boolean checked) {
+ selectTab(MAIN_TAB_LABEL);
+ new CheckBox("Automatically remove the container when it exits (--rm)").toggle(checked);
+ }
+
+ public void setPrivilegedMode(boolean checked) {
+ selectTab(MAIN_TAB_LABEL);
+ new CheckBox("Give extended privileges to this container (--privileged)").toggle(checked);
+ }
+
+ // volumes tab
+ public void removeVolume(String valueName) {
+ removeValueInTable(VOLUMES_TAB_LABEL, valueName);
+ }
+
+ public void addDataVolumeNoExternalMount(String containerPath) {
+ selectTab(VOLUMES_TAB_LABEL);
+ new PushButton("Add..").click();
+ new LabeledText("Container path:").setText(containerPath);
+ new RadioButton("No external mount").click();
+ new OkButton().click();
+ }
+
+ public void addDataVolumeToHost(String containerPath, String path) {
+ addDataVolumeToHost(containerPath, path, false);
+ }
+
+ public void addDataVolumeToHost(String containerPath, String path, boolean readOnly) {
+ selectTab(VOLUMES_TAB_LABEL);
+ new PushButton("Add...").click();
+ new LabeledText("Container path:").setText(containerPath);
+ new RadioButton("Mount a host directory or host file").click();
+ new LabeledText("Path:").setText(path);
+ new CheckBox("Read-only access").toggle(readOnly);
+ new OkButton().click();
+ }
+
+ public void addDataVolumeToContainer(String containerPath, String containerName) {
+ selectTab(VOLUMES_TAB_LABEL);
+ new PushButton("Add...").click();
+ new LabeledText("Container path:").setText(containerPath);
+ new RadioButton("Mount a data volume container").click();
+ new DefaultCombo("Container").setText(containerName);
+ new OkButton().click();
+ }
+
+ // ports tab
+ public void setPublishAllExposedPortsToRandomPorts(boolean checked) {
+ new CheckBox("Publish all exposed ports to random ports on the host interfaces").toggle(checked);
+ }
+
+ public void addPort(String containerPort, String hostAddress, String hostPort) {
+ selectTab(PORTS_TAB_LABEL);
+ setPublishAllExposedPortsToRandomPorts(false);
+ new PushButton("Add...").click();
+ new WaitUntil(new ShellWithTextIsAvailable("Exposing a Container Port"));
+ new LabeledText("Container port:").setText(containerPort);
+ new LabeledText("Host address:").setText(hostAddress);
+ new LabeledText("Host port:").setText(hostPort);
+ new OkButton().click();
+ }
+
+ public void editPort(String oldContainerPort, String newContainerPort, String newHostAddress, String newHostPort) {
+ selectTab(PORTS_TAB_LABEL);
+ setPublishAllExposedPortsToRandomPorts(false);
+ if (selectItemInTable(oldContainerPort)) {
+ new PushButton("Edit...");
+ new WaitUntil(new ShellWithTextIsAvailable("Exposing a Container Port"));
+ new LabeledText("Container port:").setText(newContainerPort);
+ new LabeledText("Host address:").setText(newHostAddress);
+ new LabeledText("Host port:").setText(newHostPort);
+ new OkButton().click();
+ } else {
+ throw new EclipseLayerException("There is no " + oldContainerPort + " in table on tab " + PORTS_TAB_LABEL);
+ }
+ }
+
+ public void removePort(String valueName) {
+ setPublishAllExposedPortsToRandomPorts(false);
+ removeValueInTable(PORTS_TAB_LABEL, valueName);
+ }
+
+ // links tab
+ public void addLink(String containerName, String alias) {
+ selectTab(LINKS_TAB_LABEL);
+ new PushButton("Add...").click();
+ new WaitWhile(new ShellWithTextIsAvailable("Container Linking"));
+ new LabeledText("Container:").setText(containerName);
+ new LabeledText("Value:").setText(alias);
+ new OkButton().click();
+ }
+
+ public void editLink(String oldContainer, String newContainer, String newAlias) {
+ selectTab(LINKS_TAB_LABEL);
+ if (selectItemInTable(oldContainer)) {
+ new PushButton("Edit...").click();
+ new WaitWhile(new ShellWithTextIsAvailable("Container Linking"));
+ new LabeledText("Container:").setText(newContainer);
+ new LabeledText("Value:").setText(newAlias);
+ new OkButton().click();
+ } else {
+ throw new EclipseLayerException("There is no " + oldContainer + " in table on tab " + LINKS_TAB_LABEL);
+ }
+ }
+
+ public void removeLink(String linkName) {
+ removeValueInTable(LINKS_TAB_LABEL, linkName);
+ }
+
+ // environment tab
+ public void addEnvironmentVariable(String variableName, String variableValue) {
+ addValueInTable(ENVIRONMENT_TAB_LABEL, "Environment Variable", variableName, variableValue);
+ }
+
+ public void editEnvironmentVariable(String oldVariable, String newVariable, String newValue) {
+ editValueInTable(ENVIRONMENT_TAB_LABEL, "Environment Variable", oldVariable, newVariable, newValue);
+ }
+
+ public void removeEnvironmentVariable(String variableName) {
+ removeValueInTable(ENVIRONMENT_TAB_LABEL, variableName);
+ }
+
+ // labels tab
+ public void addLabel(String name, String value) {
+ addValueInTable(LABELS_TAB_LABEL, "Label", name, value);
+ }
+
+ public void removeLabel(String label) {
+ removeValueInTable(LABELS_TAB_LABEL, label);
+ }
+
+ public void editLabel(String label, String newName, String newValue) {
+ editValueInTable(LABELS_TAB_LABEL, "Label", label, newName, newValue);
+ }
+
+ // resources tab
+ public void setHigh() {
+ setEnableResourceLimitations(true);
+ new RadioButton("High").click();
+ }
+
+ public void setMedium() {
+ setEnableResourceLimitations(true);
+ new RadioButton("Medium").click();
+ }
+
+ public void setLow() {
+ setEnableResourceLimitations(true);
+ new RadioButton("Low").click();
+ }
+
+ public void setEnableResourceLimitations(boolean check) {
+ selectTab(RESOURCES_TAB_LABEL);
+ new CheckBox("Enable resource limitations").toggle(check);
+ }
+
+ public void setMemoryLimit(String memoryLimit) {
+ selectTab(RESOURCES_TAB_LABEL);
+ new CheckBox("Enable resource limitations").toggle(true);
+ new LabeledText("Memory limit:").setText(memoryLimit);
+ }
+
+ public String getMemoryLimit() {
+ selectTab(RESOURCES_TAB_LABEL);
+ new CheckBox("Enable resource limitations").toggle(true);
+ return new LabeledText("Memory limit:").getText();
+ }
+
+ /**
+ * Selects tab with a given label.
+ *
+ * @param label
+ * Label
+ * @return
+ */
+ public DefaultCTabItem selectTab(String label) {
+ DefaultCTabItem tab = new DefaultCTabItem(label);
+ tab.activate();
+ return tab;
+ }
+
+ private boolean selectItemInTable(String itemName) {
+ Table table = new DefaultTable();
+ if (table.containsItem(itemName)) {
+ table.select(itemName);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void deleteRunConfiguration(String configuratioName) {
+ selectConfiguration(configuratioName);
+ new DefaultToolItem(DELETE_LAUNCH_CONFIGURATION_LABEL).click();
+ new WaitUntil(new ShellWithTextIsAvailable("Confirm Launch Configuration Deletion"));
+ new PushButton("Yes").click();
+ new WaitUntil(new ShellWithTextIsAvailable("Run Configurations"));
+ }
+
+ public void runConfiguration(String configurationName) {
+ selectConfiguration(configurationName);
+ new PushButton("Run").click();
+ }
+
+ public void close() {
+ new PushButton("Close").click();
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/AuthenticationMethod.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/AuthenticationMethod.java
new file mode 100644
index 0000000..244aa87
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/AuthenticationMethod.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.linuxtools.docker.reddeer.ui.resources;
+
+/**
+ *
+ * @author mlabuda@redhat.com, jkopriva@redhat.com
+ *
+ */
+public enum AuthenticationMethod {
+ UNIX_SOCKET("Unix socket"), TCP_CONNECTION("TCP Connection");
+
+ private final String text;
+
+ private AuthenticationMethod(String text) {
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ return text;
+ }
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerConnection.java
new file mode 100644
index 0000000..bc3a208
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerConnection.java
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.ui.resources;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.linuxtools.docker.reddeer.ui.AbstractDockerExplorerItem;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.jface.exception.JFaceLayerException;
+import org.jboss.reddeer.swt.api.Combo;
+import org.jboss.reddeer.swt.api.Shell;
+import org.jboss.reddeer.swt.api.TreeItem;
+import org.jboss.reddeer.swt.condition.ShellIsAvailable;
+import org.jboss.reddeer.swt.condition.WidgetIsEnabled;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.combo.DefaultCombo;
+import org.jboss.reddeer.swt.impl.menu.ContextMenu;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+import org.jboss.reddeer.swt.impl.toolbar.DefaultToolItem;
+
+/**
+ *
+ * @author jkopriva@redhat.com, mlabuda@redhat.com
+ *
+ */
+
+public class DockerConnection extends AbstractDockerExplorerItem {
+
+ // image name label in dialog
+ private static final String IMAGE_NAME_LABEL_DIALOG = "Image name:";
+
+ public DockerConnection(TreeItem treeItem) {
+ super(treeItem);
+ }
+
+ public void enableConnection() {
+ select();
+ new DefaultToolItem("Enable Connection").click();
+ new WaitWhile(new JobIsRunning());
+ }
+
+ /**
+ * Gets docker image with specified image name and latest tag.
+ *
+ * @param imageName
+ * docker image name
+ * @return tree item of docker image or null if does not exist
+ */
+ public DockerImage getImage(String imageName) {
+ return getImage(imageName, "latest");
+ }
+
+ /**
+ * Gets docker image with specified image name and specified tag.
+ *
+ * @param imageName
+ * docker image name
+ * @param tag
+ * image tag
+ * @return tree item of docker image or null if does not exist
+ */
+ public DockerImage getImage(String imageName, String tag) {
+ try {
+ List<TreeItem> images = treeViewerHandler.getTreeItems(item, "Images", imageName + ":");
+
+ for (TreeItem item : images) {
+ if (hasTag(tag, item)) {
+ return new DockerImage(item);
+ }
+ }
+ } catch (JFaceLayerException ex) {
+ }
+ return null;
+ }
+
+ private boolean hasTag(String tag, TreeItem item) {
+ String[] styledTexts = treeViewerHandler.getStyledTexts(item);
+ if (styledTexts == null || styledTexts.length == 0) {
+ return false;
+ }
+ return StringUtils.contains(styledTexts[0].trim(), tag);
+ }
+
+ /**
+ * Refresh images.
+ */
+ public void refreshImages() {
+ treeViewerHandler.getTreeItem(item, "Images").select();
+ new ContextMenu("Refresh").select();
+ new WaitWhile(new JobIsRunning());
+ }
+
+ /**
+ * Refresh containers.
+ */
+ public void refreshContainers() {
+ treeViewerHandler.getTreeItem(item, "Containers").select();
+ new ContextMenu("Refresh").select();
+ new WaitWhile(new JobIsRunning());
+ }
+
+ /**
+ * Refresh images and containers.
+ */
+ public void refresh() {
+ refreshImages();
+ refreshContainers();
+ }
+
+ public void pullImage(String imageName) {
+ pullImage(imageName, null, null);
+ }
+
+ /**
+ * Pull docker image with specified name and tag. If tag is null, latest tag
+ * is assumed. If image exists, nothing happens.
+ *
+ * @param imageName
+ * name of docker image to pull
+ * @param tag
+ * tag of docker image to null
+ */
+ public void pullImage(String imageName, String imageTag) {
+ pullImage(imageName, imageTag, null);
+ }
+
+ public void pullImage(String imageName, String imageTag, String dockerRegister) {
+ if (getImage(imageName, imageTag) == null) {
+ refreshImages();
+
+ treeViewerHandler.getTreeItem(item, "Images").select();
+ new ContextMenu("Pull...").select();
+
+ new WaitUntil(new ShellWithTextIsAvailable("Pull Image"), TimePeriod.NORMAL);
+ Shell pullShell = new DefaultShell("Pull Image");
+
+ // select register
+ if (dockerRegister != null) {
+ Combo combo = new DefaultCombo();
+ combo.setSelection(dockerRegister);
+ }
+
+ new LabeledText(IMAGE_NAME_LABEL_DIALOG).setFocus();
+ new LabeledText(IMAGE_NAME_LABEL_DIALOG).setText(imageTag == null ? imageName : imageName + ":" + imageTag);
+
+ new WaitUntil(new WidgetIsEnabled(new FinishButton()));
+ new FinishButton().click();
+
+ new WaitWhile(new ShellIsAvailable(pullShell));
+ new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
+ }
+ }
+
+ public void openImageSearchDialog(String imageName, String imageTag, String dockerRegister) {
+ refreshImages();
+
+ treeViewerHandler.getTreeItem(item, "Images").select();
+ new ContextMenu("Pull...").select();
+
+ new WaitUntil(new ShellWithTextIsAvailable("Pull Image"), TimePeriod.NORMAL);
+
+ // select register
+ if (dockerRegister != null) {
+ Combo combo = new DefaultCombo();
+ combo.setSelection(dockerRegister);
+ }
+
+ new LabeledText(IMAGE_NAME_LABEL_DIALOG).setFocus();
+ new LabeledText(IMAGE_NAME_LABEL_DIALOG).setText(imageTag == null ? imageName : imageName + ":" + imageTag);
+ new PushButton("Search...").click();
+ }
+
+ public boolean imageIsDeployed(String imageName) {
+ return deployedImagesCount(imageName) >= 1;
+ }
+
+ public int deployedImagesCount(String imageName) {
+ int count = 0;
+ select();
+ List<String> imagesNames = getImagesNames(true);
+ for (String imageNameFromList : imagesNames) {
+ if (imageNameFromList.contains(imageName)) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ public boolean containerIsDeployed(String containerName) {
+ return getContainer(containerName) != null;
+ }
+
+ public void removeConnection() {
+ select();
+ new DefaultToolItem("Remove Connection").click();
+ new WaitWhile(new JobIsRunning());
+ }
+
+ public DockerContainer getContainer(String containerName) {
+ try {
+ List<TreeItem> containers = treeViewerHandler.getTreeItems(item, "Containers", containerName);
+ return new DockerContainer(containers.get(0));
+ } catch (JFaceLayerException ex) {
+ // Container does not exist.
+ return null;
+ }
+ }
+
+ /**
+ * Returns all the names of all image, without the tag.
+ *
+ * @return
+ */
+ public List<String> getImagesNames() {
+ return getImagesNames(false);
+ }
+
+ public List<String> getImagesNames(boolean withTag) {
+ select();
+ List<String> imagesNames = new ArrayList<String>();
+ List<TreeItem> images = treeViewerHandler.getTreeItem(item, "Images").getItems();
+ for (TreeItem item : images) {
+ String imageName = treeViewerHandler.getNonStyledText(item);
+ if (withTag) {
+ String imageTag = getImageTag(item);
+ imagesNames.add(imageName + imageTag);
+ } else {
+ imagesNames.add(imageName);
+ }
+
+ }
+ return imagesNames;
+ }
+
+ private String getImageTag(TreeItem item) {
+ String[] styledTexts = treeViewerHandler.getStyledTexts(item);
+ if (styledTexts == null || styledTexts.length == 0) {
+ return null;
+ }
+ return styledTexts[0];
+ }
+
+ public List<String> getContainersNames() {
+ select();
+ List<String> containersNames = new ArrayList<String>();
+ List<TreeItem> containers = treeViewerHandler.getTreeItem(item, "Containers").getItems();
+ for (TreeItem item : containers) {
+ containersNames.add(treeViewerHandler.getNonStyledText(item));
+ }
+ return containersNames;
+ }
+
+ public String getName() {
+ return treeViewerHandler.getNonStyledText(this.item);
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerContainer.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerContainer.java
new file mode 100644
index 0000000..443bf87
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerContainer.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.ui.resources;
+
+import org.eclipse.linuxtools.docker.reddeer.ui.AbstractDockerExplorerItem;
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitUntil;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.condition.ShellWithTextIsAvailable;
+import org.jboss.reddeer.swt.api.Menu;
+import org.jboss.reddeer.swt.api.TreeItem;
+import org.jboss.reddeer.swt.impl.button.PushButton;
+import org.jboss.reddeer.swt.impl.menu.ContextMenu;
+
+/**
+ *
+ * @author jkopriva@redhat.com
+ *
+ */
+
+public class DockerContainer extends AbstractDockerExplorerItem {
+
+ public DockerContainer(TreeItem treeItem) {
+ super(treeItem);
+ }
+
+ public void remove() {
+ select();
+ Menu contextMenu = new ContextMenu("Remove");
+ if (!contextMenu.isEnabled()) {
+ new ContextMenu("Stop").select();
+ new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
+ item.select();
+ contextMenu = new ContextMenu("Remove");
+ }
+ contextMenu.select();
+ new WaitUntil(new ShellWithTextIsAvailable("Confirm Remove Container"), TimePeriod.NORMAL);
+ new PushButton("OK").click();
+ new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerImage.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerImage.java
new file mode 100644
index 0000000..1a60a5f
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/ui/resources/DockerImage.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.linuxtools.docker.reddeer.ui.resources;
+
+import org.jboss.reddeer.common.wait.TimePeriod;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.swt.api.Combo;
+import org.jboss.reddeer.swt.api.Shell;
+import org.jboss.reddeer.swt.api.TreeItem;
+import org.jboss.reddeer.swt.condition.ShellIsAvailable;
+import org.jboss.reddeer.swt.impl.button.CheckBox;
+import org.jboss.reddeer.swt.impl.button.FinishButton;
+import org.jboss.reddeer.swt.impl.button.OkButton;
+import org.jboss.reddeer.swt.impl.combo.DefaultCombo;
+import org.jboss.reddeer.swt.impl.menu.ContextMenu;
+import org.jboss.reddeer.swt.impl.shell.DefaultShell;
+import org.jboss.reddeer.swt.impl.text.LabeledText;
+import org.eclipse.linuxtools.docker.reddeer.ui.AbstractDockerExplorerItem;
+
+/**
+ *
+ * @author jkopriva@redhat.com, mlabuda@redhat.com
+ *
+ */
+
+public class DockerImage extends AbstractDockerExplorerItem {
+
+ public DockerImage(TreeItem treeItem) {
+ super(treeItem);
+ }
+
+ /**
+ * * Removes docker image.
+ */
+ public void remove() {
+ select();
+ new ContextMenu("Remove").select();
+
+ Shell confirm = new DefaultShell("Confirm Remove Image");
+ new OkButton().click();
+
+ new WaitWhile(new ShellIsAvailable(confirm));
+ new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
+ }
+
+ public void openImageHierarchy() {
+ select();
+ new ContextMenu("Open Image Hierarchy").select();
+ }
+
+ public void pushImage(String registryAccount, boolean forceTagging, boolean keepTaggedImage) {
+ select();
+ new ContextMenu("Push...").select();
+ new DefaultShell("Push Image");
+ Combo combo = new DefaultCombo();
+ combo.setSelection(registryAccount);
+ new CheckBox("Force tagging image with selected registry").toggle(forceTagging);
+ new CheckBox("Keep tagged image upon completion").toggle(keepTaggedImage);
+ new FinishButton().click();
+ }
+
+ public void addTagToImage(String newTag) {
+ select();
+ new ContextMenu("Add Tag").select();
+ new DefaultShell("Tag Image");
+ new LabeledText("New Tag:").setText(newTag);
+ new FinishButton().click();
+ }
+
+ public void run() {
+ select();
+ new ContextMenu("Run...").select();
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/utils/BrowserContentsCheck.java b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/utils/BrowserContentsCheck.java
new file mode 100644
index 0000000..534c4cf
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.reddeer/src/org/eclipse/linuxtools/docker/reddeer/utils/BrowserContentsCheck.java
@@ -0,0 +1,133 @@
+package org.eclipse.linuxtools.docker.reddeer.utils;
+
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+import static org.junit.Assert.assertFalse;
+
+import org.jboss.reddeer.common.condition.AbstractWaitCondition;
+import org.jboss.reddeer.common.matcher.RegexMatcher;
+import org.jboss.reddeer.common.wait.WaitWhile;
+import org.jboss.reddeer.core.condition.JobIsRunning;
+import org.jboss.reddeer.core.exception.CoreLayerException;
+import org.jboss.reddeer.eclipse.ui.browser.BrowserEditor;
+import org.jboss.reddeer.eclipse.ui.browser.BrowserView;
+import org.jboss.reddeer.eclipse.ui.console.ConsoleView;
+
+/**
+ *
+ * Class is checking contents of browser.
+ *
+ * @author rhopp@redhat.com, jkopriva@redhat.com
+ *
+ */
+
+public class BrowserContentsCheck {
+
+ /**
+ *
+ * Close browser if it was opened.
+ *
+ */
+ protected static void closeBrowser() {
+ try {
+ BrowserEditor browser = new BrowserEditor(new RegexMatcher(".*"));
+ while (browser != null) {
+ browser.close();
+ try {
+ browser = new BrowserEditor(new RegexMatcher(".*"));
+ } catch (CoreLayerException ex) {
+ // Browser editor is not opened
+ browser = null;
+ }
+ }
+ } catch (CoreLayerException ex) {
+ return;
+ }
+ }
+
+ /**
+ *
+ * Checks browser, if page is accessible and address is correct.
+ *
+ * @param browserEditor
+ */
+ public static void checkBrowserForErrorPage(BrowserEditor browserEditor) {
+ evaluateBrowserPage(browserEditor.getText());
+ }
+
+ /**
+ *
+ * Checks browser, if page is accessible and address is correct.
+ *
+ * @param browserView
+ * @param url
+ */
+ public static void checkBrowserForErrorPage(BrowserView browserView, String url) {
+ // Try to refresh page if it is not loaded.
+ if (browserView.getText().contains("Unable") || browserView.getText().contains("404")) {
+ if (url == null) {
+ browserView.refreshPage();
+ } else {
+ browserView.openPageURL(url);
+ }
+ }
+ new WaitWhile(new JobIsRunning());
+ evaluateBrowserPage(browserView.getText());
+ }
+
+ /**
+ *
+ * Evaluate page text, if it not empty or without error.
+ *
+ * @param browserPage
+ */
+ private static void evaluateBrowserPage(String browserPage) {
+ ConsoleView consoleView = new ConsoleView();
+ consoleView.open();
+ assertFalse(
+ "Browser contains text 'Status 404'\n Console output:\n" + consoleView.getConsoleText()
+ + System.getProperty("line.separator") + "Browser contents:" + browserPage,
+ browserPage.contains("Status 404") || browserPage.contains("404 - Not Found"));
+ assertFalse(
+ "Browser contains text 'Error processing request'\n Console output:\n" + consoleView.getConsoleText()
+ + System.getProperty("line.separator") + "Browser contents:" + browserPage,
+ browserPage.contains("Error processing request"));
+ assertFalse(
+ "Browser contains text 'Forbidden'\n Console output:\n" + consoleView.getConsoleText()
+ + System.getProperty("line.separator") + "Browser contents:" + browserPage,
+ browserPage.contains("Forbidden"));
+
+ }
+
+ /**
+ *
+ * Wait condition if browser is empty.
+ *
+ */
+ class BrowserIsNotEmpty extends AbstractWaitCondition {
+
+ BrowserEditor browser;
+
+ public BrowserIsNotEmpty(BrowserEditor browser) {
+ this.browser = browser;
+ }
+
+ public boolean test() {
+ return !browser.getText().equals("");
+ }
+
+ public String description() {
+ return "Browser is empty!";
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/META-INF/MANIFEST.MF b/containers/org.eclipse.linuxtools.docker.ui.tests/META-INF/MANIFEST.MF
index 5d1bc41..847b39a 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/META-INF/MANIFEST.MF
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/META-INF/MANIFEST.MF
@@ -22,7 +22,6 @@
org.mockito;bundle-version="1.9.5",
org.eclipse.linuxtools.docker.tests.hamcrest-wrap;bundle-version="1.2.0",
com.google.guava;bundle-version="15.0.0",
- org.eclipse.debug.core;bundle-version="3.10.0",
org.glassfish.hk2.api;bundle-version="2.3.0",
com.fasterxml.jackson.core.jackson-core;bundle-version="2.5.0",
com.fasterxml.jackson.core.jackson-databind;bundle-version="2.5.0",
@@ -35,3 +34,4 @@
org.eclipse.launchbar.ui.controls;bundle-version="1.0.0"
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.linuxtools.internal.docker.ui.testutils;x-friends:="org.eclipse.linuxtools.docker.reddeer,org.eclipse.linuxtools.docker.integration.tests"
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockContainerConfigFactory.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockContainerConfigFactory.java
new file mode 100644
index 0000000..914b6fe
--- /dev/null
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockContainerConfigFactory.java
@@ -0,0 +1,38 @@
+package org.eclipse.linuxtools.internal.docker.ui.testutils;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.mockito.Mockito;
+
+import com.spotify.docker.client.messages.ContainerConfig;
+
+public class MockContainerConfigFactory {
+
+ public static Builder labels(Map<String, String> labels) {
+ return new Builder().labels(labels);
+ }
+
+ public static class Builder {
+
+ private final ContainerConfig containerConfig;
+ private Map<String, String> labels;
+
+ private Builder() {
+ this.containerConfig = Mockito.mock(ContainerConfig.class, Mockito.RETURNS_DEEP_STUBS);
+ labels = Collections.emptyMap();
+ }
+
+ public Builder labels(Map<String, String> labels) {
+ this.labels = labels;
+ Mockito.when(this.containerConfig.labels()).thenReturn(this.labels);
+ return this;
+ }
+
+ public ContainerConfig build() {
+ Mockito.when(this.containerConfig.labels()).thenReturn(this.labels);
+ return this.containerConfig;
+ }
+ }
+
+}
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockContainerInfoFactory.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockContainerInfoFactory.java
index 30f2b01..bcb648f 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockContainerInfoFactory.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockContainerInfoFactory.java
@@ -12,12 +12,14 @@
package org.eclipse.linuxtools.internal.docker.ui.testutils;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.mockito.Mockito;
+import com.spotify.docker.client.messages.ContainerConfig;
import com.spotify.docker.client.messages.ContainerInfo;
import com.spotify.docker.client.messages.HostConfig;
import com.spotify.docker.client.messages.NetworkSettings;
@@ -44,14 +46,36 @@
return new Builder().networkMode(networkMode);
}
+ public static Builder id(final String id) {
+ return new Builder().id(id);
+ }
+
+ public static Builder image(final String image) {
+ return new Builder().image(image);
+ }
+
+ public static Builder ipAddress(final String ipAddress) {
+ return new Builder().ipAddress(ipAddress);
+ }
+
public static ContainerInfo build() {
return new Builder().build();
}
+ public static Builder privilegedMode(boolean mode) {
+ return new Builder().privilegedMode(mode);
+ }
+
+ public static Builder labels(Map<String, String> labels) {
+ return new Builder().labels(labels);
+ }
+
public static class Builder {
private final ContainerInfo containerInfo;
+ private Map<String, String> labels;
+
private Map<String, List<PortBinding>> ports;
private List<String> links;
@@ -60,14 +84,15 @@
private String networkMode;
+ private String ipAddress;
+
+ private Boolean privilegedMode;
+
private Builder() {
- this.containerInfo = Mockito
- .mock(ContainerInfo.class, Mockito.RETURNS_DEEP_STUBS);
- Mockito.when(this.containerInfo.id()).thenReturn(null);
- Mockito.when(this.containerInfo.created()).thenReturn(null);
+ this.containerInfo = Mockito.mock(ContainerInfo.class, Mockito.RETURNS_DEEP_STUBS);
+ Mockito.when(this.containerInfo.created()).thenReturn(new Date());
Mockito.when(this.containerInfo.path()).thenReturn(null);
Mockito.when(this.containerInfo.args()).thenReturn(null);
- Mockito.when(this.containerInfo.config()).thenReturn(null);
Mockito.when(this.containerInfo.hostConfig()).thenReturn(null);
Mockito.when(this.containerInfo.state()).thenReturn(null);
Mockito.when(this.containerInfo.image()).thenReturn(null);
@@ -86,8 +111,28 @@
}
+ public Builder labels(Map<String, String> labels) {
+ this.labels = labels;
+ return this;
+ }
+
+ public Builder privilegedMode(boolean mode) {
+ this.privilegedMode = mode;
+ return this;
+ }
+
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ public Builder id(String id) {
+ Mockito.when(this.containerInfo.id()).thenReturn(id);
+ return this;
+ }
+
public Builder link(final String link) {
- if(this.links == null) {
+ if (this.links == null) {
this.links = new ArrayList<>();
}
this.links.add(link);
@@ -95,7 +140,7 @@
}
public Builder volume(final String volume) {
- if(this.volumes == null) {
+ if (this.volumes == null) {
this.volumes = new ArrayList<>();
}
this.volumes.add(volume);
@@ -107,8 +152,13 @@
return this;
}
+ public Builder image(final String image) {
+ Mockito.when(this.containerInfo.image()).thenReturn(image);
+ return this;
+ }
+
public Builder port(final String privatePort, final String hostIp, final String hostPort) {
- if(this.ports == null) {
+ if (this.ports == null) {
this.ports = new HashMap<>();
}
final PortBinding binding = Mockito.mock(PortBinding.class);
@@ -123,14 +173,18 @@
final NetworkSettings networkSettings = Mockito.mock(NetworkSettings.class);
Mockito.when(this.containerInfo.networkSettings()).thenReturn(networkSettings);
Mockito.when(networkSettings.ports()).thenReturn(this.ports);
+ Mockito.when(networkSettings.ipAddress()).thenReturn(this.ipAddress);
final HostConfig hostConfig = Mockito.mock(HostConfig.class);
Mockito.when(this.containerInfo.hostConfig()).thenReturn(hostConfig);
Mockito.when(hostConfig.links()).thenReturn(this.links);
Mockito.when(hostConfig.binds()).thenReturn(this.volumes);
Mockito.when(hostConfig.networkMode()).thenReturn(this.networkMode);
+ Mockito.when(hostConfig.privileged()).thenReturn(this.privilegedMode);
+ final ContainerConfig containerConfig = Mockito.mock(ContainerConfig.class);
+ Mockito.when(this.containerInfo.config()).thenReturn(containerConfig);
+ Mockito.when(containerConfig.labels()).thenReturn(this.labels);
return containerInfo;
}
}
-
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerContainerConfigFactory.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerContainerConfigFactory.java
index b5b37fc..6ae5722 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerContainerConfigFactory.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockDockerContainerConfigFactory.java
@@ -13,6 +13,7 @@
import java.util.Arrays;
import java.util.Collections;
+import java.util.Map;
import org.eclipse.linuxtools.docker.core.IDockerContainerConfig;
import org.eclipse.linuxtools.internal.docker.core.DockerContainerConfig;
@@ -27,13 +28,23 @@
return new Builder().cmd(cmd);
}
+ public static Builder labels(final Map<String, String> labels) {
+ return new Builder().labels(labels);
+ }
+
public static class Builder {
private final DockerContainerConfig containerConfig;
+ private final Map<String, String> labels;
private Builder() {
- this.containerConfig = Mockito
- .mock(DockerContainerConfig.class, Mockito.RETURNS_DEEP_STUBS);
+ this.containerConfig = Mockito.mock(DockerContainerConfig.class, Mockito.RETURNS_DEEP_STUBS);
+ this.labels = Collections.emptyMap();
+ }
+
+ public Builder labels(final Map<String, String> labels) {
+ Mockito.when(this.containerConfig.labels()).thenReturn(labels);
+ return this;
}
public Builder cmd(final String cmd) {
@@ -44,10 +55,9 @@
public DockerContainerConfig build() {
Mockito.when(this.containerConfig.exposedPorts()).thenReturn(Collections.emptySet());
Mockito.when(this.containerConfig.env()).thenReturn(Collections.emptyList());
- Mockito.when(this.containerConfig.labels()).thenReturn(Collections.emptyMap());
+ Mockito.when(this.containerConfig.labels()).thenReturn(this.labels);
return this.containerConfig;
}
}
-
}
diff --git a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockImageInfoFactory.java b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockImageInfoFactory.java
index fafda7c..ed83b1c 100644
--- a/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockImageInfoFactory.java
+++ b/containers/org.eclipse.linuxtools.docker.ui.tests/src/org/eclipse/linuxtools/internal/docker/ui/testutils/MockImageInfoFactory.java
@@ -28,9 +28,9 @@
public static Builder volume(final String volume) {
return new Builder().volume(volume);
}
-
+
public static class Builder {
-
+
private final ImageInfo imageInfo;
private Set<String> volumes;
@@ -38,14 +38,15 @@
private List<String> command;
private List<String> entrypoint;
-
+
+ private List<String> env;
+
private Builder() {
- this.imageInfo = Mockito
- .mock(ImageInfo.class, Mockito.RETURNS_DEEP_STUBS);
+ this.imageInfo = Mockito.mock(ImageInfo.class, Mockito.RETURNS_DEEP_STUBS);
}
-
+
public Builder volume(final String volume) {
- if(this.volumes == null) {
+ if (this.volumes == null) {
this.volumes = new HashSet<>();
}
this.volumes.add(volume);
@@ -56,12 +57,17 @@
this.command = command;
return this;
}
-
+
public Builder entrypoint(final List<String> entrypoint) {
this.entrypoint = entrypoint;
return this;
}
-
+
+ public Builder env(final List<String> env) {
+ this.env = env;
+ return this;
+ }
+
public ImageInfo build() {
final ContainerConfig config = Mockito.mock(ContainerConfig.class);
final ContainerConfig containerConfig = Mockito.mock(ContainerConfig.class);
@@ -70,9 +76,9 @@
Mockito.when(config.cmd()).thenReturn(this.command);
Mockito.when(config.entrypoint()).thenReturn(this.entrypoint);
Mockito.when(config.volumes()).thenReturn(this.volumes);
+ Mockito.when(config.env()).thenReturn(this.env);
return imageInfo;
}
}
-
}
diff --git a/containers/pom.xml b/containers/pom.xml
index 0d04ef7..4208069 100644
--- a/containers/pom.xml
+++ b/containers/pom.xml
@@ -30,6 +30,8 @@
<module>org.eclipse.linuxtools.docker.ui.tests</module>
<module>org.eclipse.linuxtools.docker.docs</module>
<module>org.eclipse.linuxtools.docker-feature</module>
+ <module>org.eclipse.linuxtools.docker.reddeer</module>
+ <module>org.eclipse.linuxtools.docker.integration.tests</module>
</modules>
<build>
diff --git a/releng/org.eclipse.linuxtools.target/linuxtools-e4.6.target b/releng/org.eclipse.linuxtools.target/linuxtools-e4.6.target
index 7ea003f..dcc70b3 100644
--- a/releng/org.eclipse.linuxtools.target/linuxtools-e4.6.target
+++ b/releng/org.eclipse.linuxtools.target/linuxtools-e4.6.target
@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?pde version="3.8"?><target name="linuxtools-e4.6" sequenceNumber="5">
+<?pde version="3.8"?><target name="linuxtools-e4.6" sequenceNumber="18">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.swtbot.eclipse.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.swtbot.feature.group" version="0.0.0"/>
+<repository location="http://download.eclipse.org/technology/swtbot/releases/latest"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.swtchart" version="0.0.0"/>
<unit id="org.cyberneko.html" version="0.0.0"/>
<unit id="org.apache.xerces" version="0.0.0"/>
@@ -15,36 +20,10 @@
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20161205183421/repository/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.cdt.feature.group" version="0.0.0"/>
-<unit id="org.eclipse.cdt.autotools.feature.group" version="0.0.0"/>
-<repository location="http://download.eclipse.org/tools/cdt/releases/9.2"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.platform.ide" version="0.0.0"/>
-<unit id="org.eclipse.pde.runtime" version="0.0.0"/>
-<unit id="org.eclipse.jdt.core" version="0.0.0"/>
-<unit id="org.eclipse.jdt.debug.ui" version="0.0.0"/>
-<unit id="org.eclipse.jdt.ui" version="0.0.0"/>
-<repository location="http://download.eclipse.org/eclipse/updates/4.6"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.dstore.core" version="0.0.0"/>
<repository location="http://download.eclipse.org/tm/updates/3.7"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.ptp.rdt.sync.feature.group" version="0.0.0"/>
-<repository location="http://download.eclipse.org/tools/ptp/updates/neon/"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.remote.feature.group" version="0.0.0"/>
-<repository location="http://download.eclipse.org/tools/ptp/updates/remote/neon/"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.swtbot.eclipse.feature.group" version="0.0.0"/>
-<unit id="org.eclipse.swtbot.feature.group" version="0.0.0"/>
-<repository location="http://download.eclipse.org/technology/swtbot/releases/latest"/>
-</location>
-<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.license.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/cbi/updates/license"/>
</location>
@@ -54,11 +33,50 @@
<repository location="http://download.eclipse.org/releases/neon/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.platform.ide" version="0.0.0"/>
+<unit id="org.eclipse.pde.runtime" version="0.0.0"/>
+<unit id="org.eclipse.jdt.core" version="0.0.0"/>
+<unit id="org.eclipse.jdt.debug.ui" version="0.0.0"/>
+<unit id="org.eclipse.jdt.ui" version="0.0.0"/>
+<repository location="http://download.eclipse.org/eclipse/updates/4.6"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.ptp.rdt.sync.feature.group" version="0.0.0"/>
+<repository location="http://download.eclipse.org/tools/ptp/updates/neon/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.cdt.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.cdt.autotools.feature.group" version="0.0.0"/>
+<repository location="http://download.eclipse.org/tools/cdt/releases/9.2"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.tm.terminal.feature.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/tm/terminal/updates/4.1"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
-<unit id="org.eclipse.launchbar.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.remote.feature.group" version="0.0.0"/>
+<repository location="http://download.eclipse.org/tools/ptp/updates/remote/neon/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.jboss.reddeer.junit.extension.feature.feature.group" version="1.2.1.Final"/>
+<repository location="http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/1.2.1/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.jboss.reddeer.eclipse.feature.feature.group" version="1.2.1.Final"/>
+<repository location="http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/1.2.1/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.apache.commons.lang" version="2.6.0.v201404270220"/>
+<unit id="org.apache.commons.io" version="2.2.0.v201405211200"/>
+<unit id="org.apache.commons.lang3" version="3.1.0.v201403281430"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20161205183421/repository/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.jboss.reddeer.ui.feature.feature.group" version="1.2.1.Final"/>
+<repository location="http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/1.2.1/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.eclipse.launchbar.feature.group" version="2.1.0.201702230100"/>
<repository location="https://hudson.eclipse.org/cdt/job/launchbar-master/lastSuccessfulBuild/artifact/repo/target/repository/"/>
</location>
</locations>
diff --git a/releng/org.eclipse.linuxtools.target/linuxtools-e4.7.target b/releng/org.eclipse.linuxtools.target/linuxtools-e4.7.target
index a670d05..7607f7f 100644
--- a/releng/org.eclipse.linuxtools.target/linuxtools-e4.7.target
+++ b/releng/org.eclipse.linuxtools.target/linuxtools-e4.7.target
@@ -58,6 +58,24 @@
<repository location="http://download.eclipse.org/tm/terminal/builds/development/nightly"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.jboss.reddeer.junit.extension.feature.feature.group" version="1.2.1.Final"/>
+<repository location="http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/1.2.1/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.jboss.reddeer.eclipse.feature.feature.group" version="1.2.1.Final"/>
+<repository location="http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/1.2.1/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.apache.commons.lang" version="2.6.0.v201404270220"/>
+<unit id="org.apache.commons.io" version="2.2.0.v201405211200"/>
+<unit id="org.apache.commons.lang3" version="3.1.0.v201403281430"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20161205183421/repository/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<unit id="org.jboss.reddeer.ui.feature.feature.group" version="1.2.1.Final"/>
+<repository location="http://download.jboss.org/jbosstools/neon/stable/updates/reddeer/1.2.1/"/>
+</location>
+<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.launchbar.feature.group" version="0.0.0"/>
<repository location="https://hudson.eclipse.org/cdt/job/launchbar-master/lastSuccessfulBuild/artifact/repo/target/repository/"/>
</location>