use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.
the class OpenShiftUtils method deleteAllProjects.
public static void deleteAllProjects(Connection connection) {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
explorer.getOpenShift3Connection(connection).refresh();
new WaitWhile(new JobIsRunning());
List<OpenShiftProject> projects = explorer.getOpenShift3Connection(connection).getAllProjects();
for (OpenShiftProject project : projects) {
if (project != null) {
String projectName = project.getName();
try {
project.delete();
new WaitWhile(new OpenShiftProjectExists(projectName, connection), TimePeriod.LONG);
} catch (CoreLayerException ex) {
// project does not exist - project has been deleted but view has not been
// refreshed
explorer.getOpenShift3Connection(connection).refresh();
}
}
}
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.
the class OpenShiftProjectRequirement method cleanUp.
@Override
public void cleanUp() {
if (projectSpec.cleanup()) {
Connection connection = ConnectionUtils.getConnectionOrDefault(projectSpec.connectionURL());
connection.deleteResource(project);
new WaitWhile(new OpenShiftProjectExists(project.getName(), connection));
}
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.
the class OpenShift3NativeProjectUtils method createProject.
public static IProject createProject(String name, String displayName, String description, Connection connection) {
assertTrue(StringUtils.isNotBlank(name));
assertNotNull(displayName);
assertNotNull(description);
assertNotNull(connection);
IProjectRequest request = connection.getResourceFactory().stub(ResourceKind.PROJECT_REQUEST, name);
request.setDisplayName(StringUtils.isEmpty(displayName) ? name : displayName);
request.setDescription(StringUtils.isEmpty(description) ? name : description);
CreateProjectWaitCondition createProjectWaitCondition = new CreateProjectWaitCondition(connection, request);
new WaitUntil(createProjectWaitCondition, TimePeriod.VERY_LONG);
IProject createdProject = createProjectWaitCondition.getProject();
/**
* WORKAROUND: explorer wont get notified of the the new project and
* therefore wont display it unless a manual refresh is done on the
* connection. https://issues.jboss.org/browse/JBIDE-23513 remove
* this wait once WatchManager is watching projects and notifies the
* ui.
*
* @see WatchManager#KINDS
*/
new WaitUntil(new OpenShiftProjectExists(createdProject.getDisplayName(), connection));
return createdProject;
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.
the class EditResourcesTest method tearDown.
public static void tearDown() {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
explorer.reopen();
OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
connection.getProject().delete();
try {
new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()));
} catch (WaitTimeoutExpiredException ex) {
connection.refresh();
new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()), TimePeriod.getCustom(5));
}
connection.createNewProject();
ProjectExplorer projectExplorer = new ProjectExplorer();
projectExplorer.open();
if (projectExplorer.containsProject(PROJECT_NAME)) {
projectExplorer.getProject(PROJECT_NAME).delete(true);
}
}
use of org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists in project jbosstools-openshift by jbosstools.
the class HandleCustomTemplateTest method cleanUp.
@After
public void cleanUp() {
OpenShiftExplorerView explorer = new OpenShiftExplorerView();
explorer.reopen();
OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
connection.getProject().delete();
try {
new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()));
} catch (WaitTimeoutExpiredException ex) {
connection.refresh();
new WaitWhile(new OpenShiftProjectExists(connectionReq.getConnection()), TimePeriod.getCustom(5));
}
connection.createNewProject();
}
Aggregations