use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning 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.reddeer.workbench.core.condition.JobIsRunning in project linuxtools by eclipse.
the class ContainerTabTest method runContainer.
private void runContainer(String connectionName, String imageName, String imageTag, String containerName) {
DockerImagesTab imagesTab = openDockerImagesTab();
imagesTab.runImage(imageName);
ImageRunSelectionPage firstPage = new ImageRunSelectionPage(imagesTab);
firstPage.setContainerName(containerName);
firstPage.finish();
if (mockitoIsUsed()) {
MockUtils.runContainer(connectionName, imageName, imageTag, containerName);
}
getConnection().refresh();
new WaitWhile(new JobIsRunning());
}
use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning in project linuxtools by eclipse.
the class ImageTabTest method testImageTabSearch.
@Test
public void testImageTabSearch() {
pullImage(IMAGE_HELLO_WORLD);
DockerImagesTab imageTab = new DockerImagesTab();
imageTab.activate();
imageTab.refresh();
new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
imageTab.searchImage("aaa");
assertTrue("Search result is not 0!", imageTab.getTableItems().size() == 0);
imageTab.searchImage("");
assertTrue("Search result is 0!", imageTab.getTableItems().size() > 0);
}
use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning in project linuxtools by eclipse.
the class ImageTabTest method testImageTab.
@Test
public void testImageTab() {
pullImage(IMAGE_HELLO_WORLD);
DockerImagesTab imageTab = new DockerImagesTab();
imageTab.activate();
imageTab.refresh();
new WaitWhile(new JobIsRunning(), TimePeriod.DEFAULT);
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();
PropertySheet propertiesView = new PropertySheet();
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));
}
use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning in project linuxtools by eclipse.
the class LaunchDockerImageTest method runDockerImageLaunchConfiguration.
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);
}
Aggregations