Search in sources :

Example 1 with OpenShiftProject

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject in project jbosstools-openshift by jbosstools.

the class PublishChangesTest method waitForRunningApplication.

@BeforeClass
public static void waitForRunningApplication() {
    new ProjectExplorer().deleteAllProjects(true);
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.COMPLETE, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(1000));
    OpenShiftExplorerView openShiftExplorerView = new OpenShiftExplorerView();
    OpenShiftProject project = openShiftExplorerView.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName());
    new WaitUntil(new ApplicationPodIsRunning(project), TimePeriod.LONG);
    cloneGitRepoAndImportProject();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ApplicationPodIsRunning(org.jboss.tools.openshift.reddeer.condition.ApplicationPodIsRunning) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) BeforeClass(org.junit.BeforeClass)

Example 2 with OpenShiftProject

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject 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();
            }
        }
    }
}
Also used : OpenShiftProjectExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftProjectExists) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 3 with OpenShiftProject

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject in project jbosstools-openshift by jbosstools.

the class CreateApplicationOnBuilderImageTest method testCreateApplicationBasedOnBuilderImage.

@Test
public void testCreateApplicationBasedOnBuilderImage() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    new NewOpenShift3ApplicationWizard(connectionReq.getConnection()).openWizardFromExplorer();
    BuilderImageApplicationWizardHandlingTest.nextToBuildConfigurationWizardPage();
    applicationName = new LabeledText("Name: ").getText();
    new WaitUntil(new ControlIsEnabled(new FinishButton()));
    new FinishButton().click();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.APPLICATION_SUMMARY), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.APPLICATION_SUMMARY);
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.APPLICATION_SUMMARY));
    CreateApplicationFromTemplateTest.importApplicationAndVerify(projectName);
    OpenShiftProject project = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject();
    project.refresh();
    new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(120));
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, connectionReq.getConnection()), TimePeriod.LONG, false);
    List<OpenShiftResource> buildConfig = project.getOpenShiftResources(Resource.BUILD_CONFIG);
    assertTrue("There should be precisely 1 build config for created application, but there is following amount" + " of build configs: " + buildConfig.size(), buildConfig.size() == 1);
    List<OpenShiftResource> imageStream = project.getOpenShiftResources(Resource.IMAGE_STREAM);
    assertTrue("There should be precisely 1 image stream for created application, but there is following amount" + " of image streams: " + imageStream.size(), imageStream.size() == 1);
    List<OpenShiftResource> routes = project.getOpenShiftResources(Resource.ROUTE);
    assertTrue("There should be precisely 1 route for created application, but there is following amount" + " of routes:" + routes.size(), routes.size() == 1);
    assertTrue("Generated (default) route should contain application name, but it's not contained.", routes.get(0).getName().equals(applicationName));
    List<OpenShiftResource> services = project.getOpenShiftResources(Resource.SERVICE);
    assertTrue("There should be precisely 1 service for created application, but there is following amount" + " of services: " + services.size(), services.size() == 1);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) NewOpenShift3ApplicationWizard(org.jboss.tools.openshift.reddeer.wizard.v3.NewOpenShift3ApplicationWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test) BuilderImageApplicationWizardHandlingTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.BuilderImageApplicationWizardHandlingTest)

Example 4 with OpenShiftProject

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject in project jbosstools-openshift by jbosstools.

the class ResourcesTest method verifyResourceExistence.

private void verifyResourceExistence(TreeItem projectItem, Resource resource) {
    try {
        OpenShiftProject project = new OpenShiftProject(projectItem);
        project.select();
        project.openProperties();
        project.selectTabbedProperty(resource.toString());
    } catch (RedDeerException ex) {
        fail("Resource " + resource.toString() + " does not exist under a specified project item.");
    }
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject)

Example 5 with OpenShiftProject

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject in project jbosstools-openshift by jbosstools.

the class InteligentDeleteResourceTest method checkDeletedResourceBoolean.

private boolean checkDeletedResourceBoolean(ResourceOpenShift resource) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    OpenShiftProject openshiftProject = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName());
    openshiftProject.refresh();
    DeleteResourcesWizard deleteResourcesWizard = new DeleteResourcesWizard(connectionReq.getConnection());
    deleteResourcesWizard.openWizardFromExplorer(projectReq.getProjectName());
    List<TableItem> items = deleteResourcesWizard.getResourcesByType(resource);
    deleteResourcesWizard.cancel();
    return items.isEmpty();
}
Also used : DeleteResourcesWizard(org.jboss.tools.openshift.reddeer.wizard.v3.DeleteResourcesWizard) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) TableItem(org.eclipse.reddeer.swt.api.TableItem) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)

Aggregations

OpenShiftProject (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject)12 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)11 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)5 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)5 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)4 DeleteResourcesWizard (org.jboss.tools.openshift.reddeer.wizard.v3.DeleteResourcesWizard)3 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)3 Test (org.junit.Test)3 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)2 TableItem (org.eclipse.reddeer.swt.api.TableItem)2 OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)2 OpenShiftResource (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)2 IReplicationController (com.openshift.restclient.model.IReplicationController)1 AbstractWaitCondition (org.eclipse.reddeer.common.condition.AbstractWaitCondition)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)1 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)1