Search in sources :

Example 1 with OpenShiftResourceExists

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

the class DeleteResourceTest method testDeletePod.

@Test
public void testDeletePod() {
    OpenShiftResource applicationPod = OpenShiftUtils.getOpenShiftPod(projectReq.getProjectName(), new StringStartsWith("eap-app-"), connectionReq.getConnection());
    String podName = applicationPod.getName();
    applicationPod.delete();
    try {
        OpenShiftResourceExists openShiftResourceExists = new OpenShiftResourceExists(Resource.POD, podName, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection());
        new WaitWhile(openShiftResourceExists, TimePeriod.getCustom(15));
    } catch (WaitTimeoutExpiredException ex) {
        fail("Application pod should be deleted at this point, but it it still present.");
    }
}
Also used : StringStartsWith(org.hamcrest.core.StringStartsWith) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) 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 2 with OpenShiftResourceExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists 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 3 with OpenShiftResourceExists

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

the class CreateServerAdapterTest method waitTillApplicationIsRunning.

@BeforeClass
public static void waitTillApplicationIsRunning() {
    new WaitWhile(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.RUNNING, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(600));
    new WaitUntil(new AmountOfResourcesExists(Resource.POD, 2, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG, false);
    cloneGitRepoAndImportProject();
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) 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)

Example 4 with OpenShiftResourceExists

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

the class DeploymentTest method testDeploymentOfApplicationCreatedFromTemplate.

@Test
public void testDeploymentOfApplicationCreatedFromTemplate() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.DEFAULT, false);
    try {
        new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.COMPLETE, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(600), true);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be a successful build of an application, but there is not.");
    }
    try {
        new WaitUntil(new AmountOfResourcesExists(Resource.POD, 2, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(60), true);
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be precisely 2 pods. One of the build and one of an running application.");
    }
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.ROUTE).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_WEB_BROWSER).select();
    try {
        new WaitUntil(new BrowserContainsText("Hello World!"), TimePeriod.VERY_LONG);
        new BrowserEditor("helloworld").close();
    } catch (WaitTimeoutExpiredException ex) {
        fail("Application was not deployed successfully because it is not shown in web browser properly.\n" + ex.getMessage());
    }
}
Also used : AmountOfResourcesExists(org.jboss.tools.openshift.reddeer.condition.AmountOfResourcesExists) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) BrowserEditor(org.eclipse.reddeer.eclipse.ui.browser.BrowserEditor) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) 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 5 with OpenShiftResourceExists

use of org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists 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)

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