Search in sources :

Example 11 with OpenShiftResource

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

the class OSExplorerResourceTest method testDeploymentConfigVisibleAfterServiceDeletion.

/**
 * Test if deployment config is visible in OS Explorer, when there is no service.
 */
@Test(expected = OpenshiftTestInFailureException.class)
public void testDeploymentConfigVisibleAfterServiceDeletion() {
    this.project.expand();
    Service service = this.project.getService(OpenShiftResources.EAP_SERVICE);
    assertTrue("Service does not exist!", service != null);
    service.select();
    new ContextMenuItem("Delete").select();
    new DefaultShell("Delete OpenShift Resource");
    new OkButton().click();
    // assert service is deleted
    List<OpenShiftResource> resources = this.project.getOpenShiftResources(Resource.SERVICE);
    assertTrue("Service not deleted!", resources.isEmpty());
    try {
        this.project.getTreeItem().getItem("eap-app selector: deploymentConfig=eap-app");
    } catch (CoreLayerException e) {
        // TODO: do not throw after JBIDE-24217 is fixed
        throw new OpenshiftTestInFailureException("JBIDE-24217");
    // TODO: uncomment after JBIDE-24217 is fixed
    // fail("Deployment config not visible!");
    }
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) OpenshiftTestInFailureException(org.jboss.tools.openshift.ui.bot.test.common.OpenshiftTestInFailureException) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) RequiredService(org.jboss.tools.openshift.reddeer.requirement.OpenShiftServiceRequirement.RequiredService) Service(org.jboss.tools.openshift.reddeer.view.resources.Service) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException) 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 12 with OpenShiftResource

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

the class TriggerBuildTest method testCreateNewBuildFromBuildConfig.

@Test
public void testCreateNewBuildFromBuildConfig() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.reopen();
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, (Matcher<String>) null, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.getCustom(120), true);
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, "eap-app-1", ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection()), TimePeriod.LONG, true);
    List<OpenShiftResource> builds = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD);
    int oldAmountOfBuilds = builds.size();
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(Resource.BUILD_CONFIG).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.START_BUILD).select();
    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 13 with OpenShiftResource

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

the class CreateApplicationFromTemplateTest method verifyCreatedApplication.

private void verifyCreatedApplication() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    OpenShiftProject project = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(DatastoreOS3.PROJECT1_DISPLAYED_NAME);
    project.refresh();
    new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(120));
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD_CONFIG, (Matcher<String>) null, ResourceState.UNSPECIFIED, DatastoreOS3.PROJECT1_DISPLAYED_NAME, 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);
    assertTrue("There should be application name and git URI in build config tree item, but they are not." + "Application name is '" + applicationName + "' and git URI is '" + srcRepoURI + "', but build " + "config has name '" + buildConfig.get(0).getName() + "'", buildConfig.get(0).getPropertyValue("Labels", "application").equals(applicationName) && buildConfig.get(0).getPropertyValue("Source", "URI").equals(srcRepoURI));
    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 : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) Matcher(org.hamcrest.Matcher) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) 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)

Example 14 with OpenShiftResource

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

the class OpenShiftResourceExists method test.

@Override
public boolean test() {
    // workaround for disposed widget
    if (project.getTreeItem().isDisposed()) {
        this.project = explorer.getOpenShift3Connection(connection).getProject(project.getName());
    }
    this.project.refresh();
    List<OpenShiftResource> resources = getResources();
    for (OpenShiftResource rsrc : resources) {
        if (resourceNameMatcher == null) {
            return true;
        }
        if (resourceNameMatcher.matches(rsrc.getName())) {
            if (!resourceState.equals(ResourceState.UNSPECIFIED)) {
                return resourceState.toString().equals(rsrc.getStatus());
            }
            return true;
        }
    }
    return false;
}
Also used : OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)

Example 15 with OpenShiftResource

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

the class DeleteResourceTest method deleteResourceAndAssert.

private void deleteResourceAndAssert(Resource resource) {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    OpenShiftResource rsrc = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getOpenShiftResources(resource).get(0);
    String resourceName = rsrc.getName();
    rsrc.delete();
    try {
        OpenShiftResourceExists openShiftResourceExists = new OpenShiftResourceExists(resource, resourceName, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection());
        new WaitWhile(openShiftResourceExists, TimePeriod.getCustom(15));
    } catch (WaitTimeoutExpiredException ex) {
        fail("Route " + resource + " should be deleted at this point but it is still present.");
    }
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) 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)

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