Search in sources :

Example 16 with OpenShiftResourceExists

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

the class ServerAdapterFromResourceTest method importProject.

@BeforeClass
public static void importProject() {
    explorer = new OpenShiftExplorerView();
    explorer.open();
    project = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(DatastoreOS3.TEST_PROJECT);
    project.getServicesWithName(OpenShiftResources.NODEJS_SERVICE).get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION));
    ImportApplicationWizard appWizard = new ImportApplicationWizard();
    try {
        CheckBox checkBox = new CheckBox("Do not clone - use existing repository");
        if (checkBox.isEnabled()) {
            checkBox.toggle(true);
            LOGGER.debug("Using existing project, skipping import");
        }
    } catch (RedDeerException ex) {
        LOGGER.debug("No existing project found, importing");
    }
    try {
        appWizard.finish();
    } catch (WaitTimeoutExpiredException ex) {
        // When running test in suite, it needs to be selected correct build config(in OpenShift instance could be more build configs)
        appWizard.selectExistingBuildConfiguration(OpenShiftResources.NODEJS_APP_DEPLOYMENT_CONFIG);
        appWizard.finish();
    }
    new WaitUntil(new OpenShiftResourceExists(Resource.DEPLOYMENT, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER, ResourceState.UNSPECIFIED, DatastoreOS3.TEST_PROJECT, connectionReq.getConnection()), TimePeriod.LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) ImportApplicationWizard(org.jboss.tools.openshift.reddeer.wizard.importapp.ImportApplicationWizard) 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 17 with OpenShiftResourceExists

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

the class CreateResourcesTest method testCreateResourceFromLocalFile.

@Test
public void testCreateResourceFromLocalFile() {
    createResource(RESOURCES_LOCATION + File.separator + "hello-pod.json");
    refreshProject();
    assertTrue("Hello pod has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.POD, POD_NAME) != null);
    new WaitUntil(new OpenShiftResourceExists(Resource.POD, POD_NAME, ResourceState.RUNNING, testProject, connectionReq.getConnection()), TimePeriod.LONG);
    createResource(RESOURCES_LOCATION + File.separator + "hello-service.json");
    refreshProject();
    assertTrue("Hello service has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.SERVICE, SERVICE_NAME) != null);
    assertTrue("Hello service is not visible in OpenShift Explorer view", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getService(SERVICE_NAME).getTreeItem() != null);
    createResource(RESOURCES_LOCATION + File.separator + "hello-route.json");
    refreshProject();
    assertTrue("Hello route has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.ROUTE, ROUTE_NAME) != null);
}
Also used : WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) 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 18 with OpenShiftResourceExists

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

the class CreateResourcesTest method testCreateResourceFromURL.

@Test
public void testCreateResourceFromURL() {
    createResource("https://raw.githubusercontent.com/jbosstools/jbosstools-openshift/master/itests/org.jboss.tools.openshift.ui.bot.test/resources/hello-pod.json");
    new WaitUntil(new OpenShiftResourceExists(Resource.POD, POD_NAME, ResourceState.RUNNING, testProject, connectionReq.getConnection()), TimePeriod.LONG);
    assertTrue("Hello pod has not been created from file", explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(testProject).getOpenShiftResource(Resource.POD, POD_NAME) != null);
}
Also used : WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) 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 19 with OpenShiftResourceExists

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

the class DeleteResourceTest 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)

Example 20 with OpenShiftResourceExists

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

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