use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.
the class LinkToCreateNewProjectTest method createOpenShiftProjectViaLinkInExplorer.
@Test
public void createOpenShiftProjectViaLinkInExplorer() {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
OpenShiftUtils.deleteAllProjects(connectionReq.getConnection());
TreeItem connectionItem = explorer.getOpenShift3Connection(connectionReq.getConnection()).getTreeItem();
TreeItem newProjectLinkItem = null;
try {
newProjectLinkItem = connectionItem.getItem("No projects are available. Click here to create a new project...");
} catch (RedDeerException ex) {
fail("There is no link to create a new project even connection does not have any project.");
}
TreeItemHandler.getInstance().click(newProjectLinkItem.getSWTWidget());
try {
new DefaultShell(OpenShiftLabel.Shell.CREATE_OS_PROJECT);
} catch (RedDeerException ex) {
fail("Create new OpenShift project shell has not been opened.");
}
new LabeledText(OpenShiftLabel.TextLabels.PROJECT_NAME).setText(projectName);
new WaitUntil(new ControlIsEnabled(new FinishButton()));
new FinishButton().click();
projectCreated = true;
new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.CREATE_OS_PROJECT), TimePeriod.LONG);
assertTrue("OpenShift project is not visible in OpenShift Explorer under the connection" + " although it should have been created successfully and visible.", explorer.getOpenShift3Connection(connectionReq.getConnection()).projectExists(projectName));
}
use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.
the class OpenShiftExplorerView method getConnectionItem.
private TreeItem getConnectionItem(String server, String username) {
open();
if (username == null) {
username = TreeViewerHandler.getInstance().getNonStyledText(new DefaultTree().getItems().get(0));
}
TreeItem connectionItem = treeViewerHandler.getTreeItem(new DefaultTree(), username);
if (server != null && DatastoreOS3.AUTH_METHOD.equals(AuthenticationMethod.OAUTH)) {
if (treeViewerHandler.getStyledTexts(connectionItem)[0].equals(server)) {
return connectionItem;
} else {
throw new OpenShiftToolsException("There is no connection with specified server " + server + " and username " + username);
}
} else {
return connectionItem;
}
}
use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.
the class Service method getPod.
/**
* Gets first pod matching a specified matcher.
*
* @param nameMatcher name matcher of a pod
* @return Pod belonging to an OpenShift service if there is any matching
* a specified matcher; null otherwise.
*/
@SuppressWarnings("unchecked")
public Pod getPod(Matcher<String>... matchers) {
for (TreeItem treeItem : item.getItems()) {
if (!treeItem.isDisposed()) {
String treeItemText = treeItem.getText();
boolean matches = true;
for (Matcher<String> matcher : matchers) {
if (!matcher.matches(treeItemText)) {
matches = false;
break;
}
}
if (matches) {
return new Pod(treeItem);
}
}
}
return null;
}
use of org.eclipse.reddeer.swt.api.TreeItem in project jbosstools-openshift by jbosstools.
the class OpenShift3Connection method getAllProjects.
/**
* Gets all projects existing on a connection.
*
* @return list of all projects for a connection.
*/
public List<OpenShiftProject> getAllProjects() {
List<OpenShiftProject> projects = new ArrayList<OpenShiftProject>();
activateOpenShiftExplorerView();
item.select();
item.expand();
for (TreeItem treeItem : item.getItems()) {
projects.add(new OpenShiftProject(treeItem));
}
return projects;
}
use of org.eclipse.reddeer.swt.api.TreeItem in project linuxtools by eclipse.
the class DockerExplorerView method getDockerConnectionNames.
/**
* 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;
}
Aggregations