Search in sources :

Example 6 with OpenShiftResource

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

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

the class ScalingTest method testScaleApplicationViaContextMenuOfReplicationController.

@Test
public void testScaleApplicationViaContextMenuOfReplicationController() {
    OpenShiftResource replicationController = project.getOpenShiftResource(Resource.DEPLOYMENT, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER);
    assertNotNull(replicationController);
    // ensure we scale
    int pods = PodsAreDeployed.getNumberOfCurrentReplicas(project, replicationController.getName());
    if (pods == 1) {
        pods = 2;
    } else {
        pods = 1;
    }
    replicationController.select();
    scaleTo(pods);
    assertPodAmountDesiredEqualsCurrent(pods, project);
    replicationController.select();
    scaleUp();
    assertPodAmountDesiredEqualsCurrent(++pods, project);
    replicationController.select();
    scaleDown();
    assertPodAmountDesiredEqualsCurrent(--pods, project);
}
Also used : 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 OpenShiftResource

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

the class HandleCustomTemplateTest method createTemplateFromJson.

private void createTemplateFromJson() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_RESOURCE).select();
    new DefaultShell(OpenShiftLabel.Shell.NEW_RESOURCE);
    new LabeledText(OpenShiftLabel.TextLabels.RESOURCE_LOCATION).setText(System.getProperty("user.dir") + File.separator + "resources" + File.separator + "hello-world-template.json");
    new FinishButton().click();
    new DefaultShell(OpenShiftLabel.Shell.CREATE_RESOURCE_SUMMARY);
    assertTrue("Template is not listed in created resources summary", new DefaultTree().getAllItems().size() == 1);
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.NEW_RESOURCE));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    List<OpenShiftResource> templates = explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject().getOpenShiftResources(Resource.TEMPLATE);
    assertTrue("There should be precisely 1 created template for the project.", templates.size() > 0);
    String templateName = templates.get(0).getName();
    assertTrue("Template name '" + templateName + "' does not match required name " + "helloworld-sample.", templateName.equals("helloworld-sample"));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) 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) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)

Example 9 with OpenShiftResource

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

the class LogsTest method shouldShowLogFromApplicationPodContextMenu.

@Test
public void shouldShowLogFromApplicationPodContextMenu() {
    new WaitUntil(new OpenShiftResourceExists(Resource.POD, new StringStartsWith("eap-app-"), ResourceState.RUNNING, requiredProject.getProjectName(), requiredConnection.getConnection()), TimePeriod.VERY_LONG);
    this.consoleView = new ConsoleView();
    this.consoleView.open();
    OpenShiftResource pod = OpenShiftUtils.getOpenShiftPod(requiredProject.getProjectName(), new StringStartsWith("eap-app-"), requiredConnection.getConnection());
    String podName = pod.getName();
    pod.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.POD_LOG).select();
    new WaitUntil(new ConsoleHasText(), TimePeriod.DEFAULT);
    new WaitUntil(new ConsoleHasNoChange(TimePeriod.getCustom(WAIT_CONSOLE_NO_CHANGE)), TimePeriod.VERY_LONG);
    assertTrue("Console label is incorrect, it should contains project name and pod name.\n" + "but label is: " + consoleView.getConsoleLabel(), consoleView.getConsoleLabel().contains(requiredProject.getProjectName() + "\\" + podName));
    assertTrue("Console text should contain output from EAP runtime", consoleView.getConsoleText().contains("Admin console is not enabled"));
}
Also used : StringStartsWith(org.hamcrest.core.StringStartsWith) ConsoleView(org.eclipse.reddeer.eclipse.ui.console.ConsoleView) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) ConsoleHasText(org.eclipse.reddeer.eclipse.condition.ConsoleHasText) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) ConsoleHasNoChange(org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange) 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 10 with OpenShiftResource

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

the class LogsTest method shouldShowLogFromBuildPodContextMenu.

@Test
public void shouldShowLogFromBuildPodContextMenu() {
    new WaitUntil(new OpenShiftResourceExists(Resource.BUILD, new StringStartsWith("eap-app-"), ResourceState.RUNNING, requiredProject.getProjectName(), requiredConnection.getConnection()), TimePeriod.VERY_LONG);
    this.consoleView = new ConsoleView();
    this.consoleView.open();
    OpenShiftResource pod = OpenShiftUtils.getOpenShiftPod(requiredProject.getProjectName(), Resource.BUILD, new StringStartsWith("eap-app-"), requiredConnection.getConnection());
    String podName = pod.getName();
    pod.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.BUILD_LOG).select();
    new WaitUntil(new ConsoleHasText(), TimePeriod.LONG);
    new WaitUntil(new ConsoleHasNoChange(TimePeriod.getCustom(WAIT_CONSOLE_NO_CHANGE)), TimePeriod.VERY_LONG);
    assertTrue("Console label is incorrect, it should contain project name and name of build pod.\n" + "but label is: " + consoleView.getConsoleLabel(), consoleView.getConsoleLabel().contains(requiredProject.getProjectName() + "\\" + podName));
    try {
        new WaitUntil(new ConsoleHasText("Push successful"), TimePeriod.getCustom(WAIT_CONSOLE_PUSH_SUCCESS));
    } catch (WaitTimeoutExpiredException ex) {
        fail("There should be output of succesful build in console log, but there is not.\n" + "Check whether output has not changed. Assumed output in the end of log is 'Push successful'");
    }
}
Also used : StringStartsWith(org.hamcrest.core.StringStartsWith) ConsoleView(org.eclipse.reddeer.eclipse.ui.console.ConsoleView) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) ConsoleHasText(org.eclipse.reddeer.eclipse.condition.ConsoleHasText) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) ConsoleHasNoChange(org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange) 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