Search in sources :

Example 6 with OpenShiftResourceExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.

the class DeployDockerImageTest method verifyDeployedHelloWorldDockerImage.

/**
 * Verifies whether an application pod has been created and application is running successfully.
 */
private void verifyDeployedHelloWorldDockerImage(String projectName) {
    new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).refresh();
    try {
        new WaitUntil(new OpenShiftResourceExists(Resource.POD, new StringContains("hello-openshift"), ResourceState.RUNNING, projectName, openshiftConnectionRequirement.getConnection()), TimePeriod.VERY_LONG);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be a running application pod for a deployed docker image, " + "but it does not exist.");
    }
    new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).refresh();
    new OpenShiftExplorerView().getOpenShift3Connection(openshiftConnectionRequirement.getConnection()).getProject(projectName).getOpenShiftResources(Resource.ROUTE).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_BROWSER).select();
    try {
        // getRouteURL("hello-openshift", projectName),
        new WaitUntil(new BrowserContainsText("Hello OpenShift!"), TimePeriod.VERY_LONG);
    } catch (WaitTimeoutExpiredException ex) {
        fail("Browser does not contain hello world content.");
    }
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) StringContains(org.hamcrest.core.StringContains)

Example 7 with OpenShiftResourceExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.

the class TriggerBuildTest method testCloneExistingBuild.

@Test
public void testCloneExistingBuild() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.reopen();
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, (Matcher<String>) null, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(240), true);
    List<OpenShiftResource> builds = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD);
    builds.get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.CLONE_BUILD).select();
    int oldAmountOfBuilds = builds.size();
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    try {
        new WaitUntil(new AmountOfResourcesExists(Resource.BUILD, oldAmountOfBuilds + 1, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG);
    } catch (WaitTimeoutExpiredException ex) {
        fail("New build was not triggered altough it should be.");
    }
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) AmountOfResourcesExists(org.jboss.tools.openshift.reddeer.condition.AmountOfResourcesExists) Matcher(org.hamcrest.Matcher) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) 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)

Example 8 with OpenShiftResourceExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.

the class ImportApplicationTest method testImportOpenShiftApplicationViaOpenShiftExplorer.

@Test
public void testImportOpenShiftApplicationViaOpenShiftExplorer() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, (Matcher<String>) null, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG);
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD_CONFIG).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION), TimePeriod.LONG);
    new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION);
    new CheckBox("Use default clone destination").toggle(false);
    File gitRepo = new File(GIT_REPO_DIRECTORY);
    new LabeledText("Git Clone Location:").setText(gitRepo.getAbsolutePath());
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION), TimePeriod.VERY_LONG);
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
    ProjectExplorer projectExplorer = new ProjectExplorer();
    projectExplorer.open();
    assertTrue("There should be imported kitchen sink project, but there is not", projectExplorer.containsProject(PROJECT_NAME));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) Matcher(org.hamcrest.Matcher) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) File(java.io.File) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 9 with OpenShiftResourceExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.

the class InteligentDeleteResourceTest method testDeleteFPod.

@Test
public void testDeleteFPod() {
    deleteResource(ResourceOpenShift.POD);
    new WaitWhile(new OpenShiftResourceExists(Resource.POD, POD_NAME, ResourceState.RUNNING, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG);
    if (!checkDeletedResourceBoolean(ResourceOpenShift.POD)) {
        // Wait once again - it could take some time on some machines
        new WaitWhile(new OpenShiftResourceExists(Resource.POD, POD_NAME, ResourceState.RUNNING, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG);
    }
    assertTrue("Resources are not deleted: " + ResourceOpenShift.POD.toString(), checkDeletedResourceBoolean(ResourceOpenShift.POD));
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 10 with OpenShiftResourceExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists in project jbosstools-openshift by jbosstools.

the class InteligentDeleteResourceTest method waitForApplication.

@BeforeClass
public static void waitForApplication() {
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.COMPLETE, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(600), true);
    new WaitUntil(new AmountOfResourcesExists(Resource.POD, 2, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.VERY_LONG, true);
}
Also used : AmountOfResourcesExists(org.jboss.tools.openshift.reddeer.condition.AmountOfResourcesExists) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) BeforeClass(org.junit.BeforeClass)

Aggregations

OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)20 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)17 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)11 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)11 Test (org.junit.Test)11 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)9 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)8 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)8 OpenShiftResource (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)8 AmountOfResourcesExists (org.jboss.tools.openshift.reddeer.condition.AmountOfResourcesExists)6 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)5 BeforeClass (org.junit.BeforeClass)5 Matcher (org.hamcrest.Matcher)4 OpenShiftProject (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject)4 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 StringStartsWith (org.hamcrest.core.StringStartsWith)3 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)2 ConsoleHasNoChange (org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)2 ConsoleHasText (org.eclipse.reddeer.eclipse.condition.ConsoleHasText)2 ConsoleView (org.eclipse.reddeer.eclipse.ui.console.ConsoleView)2