Search in sources :

Example 1 with OpenShiftResource

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

the class EditResourceLimitsTest method testViaContextMenuOfService.

public void testViaContextMenuOfService(int index, String defaultSuffix) {
    Service service = project.getService(OpenShiftResources.NODEJS_SERVICE);
    assertNotNull(service);
    OpenShiftResource deploymentConfig = project.getOpenShiftResource(Resource.DEPLOYMENT_CONFIG, OpenShiftResources.NODEJS_APP_DEPLOYMENT_CONFIG);
    assertNotNull(deploymentConfig);
    String version = deploymentConfig.getPropertyValue("Basic", "Resource Version");
    service.select();
    incrementLimits(index, defaultSuffix);
    new WaitUntil(new ResourceIsUpdated(project.getName(), Resource.DEPLOYMENT_CONFIG, OpenShiftResources.NODEJS_APP_DEPLOYMENT_CONFIG, new String[] { "Basic", "Resource Version" }, not(version), requiredConnection.getConnection()), TimePeriod.getCustom(800));
}
Also used : ResourceIsUpdated(org.jboss.tools.openshift.reddeer.condition.ResourceIsUpdated) RequiredService(org.jboss.tools.openshift.reddeer.requirement.OpenShiftServiceRequirement.RequiredService) Service(org.jboss.tools.openshift.reddeer.view.resources.Service) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)

Example 2 with OpenShiftResource

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource 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 3 with OpenShiftResource

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

the class ApplicationPodIsRunning method test.

@Override
public boolean test() {
    project.refresh();
    List<OpenShiftResource> pods = project.getOpenShiftResources(Resource.POD);
    if (pods.isEmpty()) {
        return false;
    }
    // for
    for (OpenShiftResource resource : pods) {
        if (!resource.getName().contains("build") && !resource.getName().contains("deploy")) {
            if (resource.getStatus().equals(ResourceState.RUNNING.toString())) {
                applicationPodName = resource.getName();
                return true;
            }
        }
    }
    return false;
}
Also used : OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)

Example 4 with OpenShiftResource

use of org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource 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 5 with OpenShiftResource

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

the class ScalingTest method scaleTo0ShouldWarn.

@Test
public void scaleTo0ShouldWarn() {
    int pods = requiredService.getReplicationController().getCurrentReplicaCount();
    new WaitUntil(new PodsAreDeployed(project, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER, pods), TimePeriod.LONG);
    OpenShiftResource replicationController = project.getOpenShiftResource(Resource.DEPLOYMENT, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER);
    replicationController.select();
    scaleTo(0);
    new DefaultShell(OpenShiftLabel.Shell.STOP_ALL_DEPLOYMENTS).setFocus();
    new YesButton().click();
    assertPodAmountDesiredEqualsCurrent(0, project);
}
Also used : DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) PodsAreDeployed(org.jboss.tools.openshift.reddeer.condition.PodsAreDeployed) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) YesButton(org.eclipse.reddeer.swt.impl.button.YesButton) 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)

Aggregations

OpenShiftResource (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)16 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)9 Test (org.junit.Test)9 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)8 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)8 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)7 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)7 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)6 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)5 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)5 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)4 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)3 Matcher (org.hamcrest.Matcher)3 StringStartsWith (org.hamcrest.core.StringStartsWith)3 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 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)2 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)2 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)2