use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.
the class LabelsTest method testLabels.
@Test
public void testLabels() {
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(IMAGE_NAME + ":" + IMAGE_TAG);
ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
firstPage.setContainerName(CONTAINER_NAME);
firstPage.setAllocatePseudoTTY();
firstPage.setKeepSTDINOpen();
firstPage.setGiveExtendedPrivileges();
firstPage.next();
ImageRunResourceVolumesVariablesPage secondPage = new ImageRunResourceVolumesVariablesPage(firstPage);
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);
PropertySheet propertiesView = new PropertySheet();
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));
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.
the class ContainerTabTest method testContainerTab.
@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.DEFAULT);
// 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
PropertySheet propertiesView = new PropertySheet();
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));
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.
the class ContainerTabTest method testContainerTabSearch.
@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);
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.
the class PerspectiveTest method testDockerContainersTabPresent.
@Test
public void testDockerContainersTabPresent() {
DockerContainersTab tab = new DockerContainersTab();
tab.open();
}
use of org.eclipse.linuxtools.docker.reddeer.ui.DockerContainersTab in project linuxtools by eclipse.
the class MockDockerConnectionManager method configureConnectionManager.
/**
* 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();
}
Aggregations