Search in sources :

Example 1 with ServerAdapterExists

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

the class ServerAdapterFromResourceTest method newAdapterFromResource.

private void newAdapterFromResource(Resource type, String name) {
    project.refresh();
    project.getOpenShiftResource(type, name).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_ADAPTER_FROM_EXPLORER).select();
    new DefaultShell(OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS);
    String resourceType = null;
    String selectors = name + " name=" + name;
    if (type.equals(Resource.DEPLOYMENT)) {
        resourceType = "ReplicationController";
        selectors = name + " deploymentconfig=" + serviceReq.getService().getName() + ", name=" + serviceReq.getService().getName() + ", deployment=" + name;
    } else {
        resourceType = type.toString().replaceFirst(".$", "").replaceAll(" ", "");
    }
    assertTrue("Resource should be preselected for new OpenShift 3 server adapter", new DefaultTreeItem(project.getName(), selectors).isSelected());
    try {
        new DefaultStyledText(resourceType);
    } catch (RedDeerException e) {
        fail("Resource type does not match");
    }
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(""));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG, false);
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, name, resourceType).test());
    adapter = new ServerAdapter(Version.OPENSHIFT3, name, resourceType);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 2 with ServerAdapterExists

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

the class CreateServerAdapterTest method finishNewServerAdapterWizardAndVerifyExistence.

public void finishNewServerAdapterWizardAndVerifyExistence() {
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.ADAPTER));
    boolean jobExists = false;
    try {
        new WaitUntil(new JobIsRunning(new StringContains(JOB_NAME)), TimePeriod.getCustom(5));
        jobExists = true;
    } catch (WaitTimeoutExpiredException e) {
    // job is not running, do nothing
    }
    if (jobExists) {
        new WaitUntil(new JobIsKilled(JOB_NAME), TimePeriod.VERY_LONG);
    }
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, "eap-app", "Service").test());
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) JobIsKilled(org.eclipse.reddeer.workbench.core.condition.JobIsKilled) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) StringContains(org.hamcrest.core.StringContains)

Example 3 with ServerAdapterExists

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

the class CreateServerAdapterTest method testCreateOpenShift3ServerAdapterViaOpenShiftExplorerView.

@Test
public void testCreateOpenShift3ServerAdapterViaOpenShiftExplorerView() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.getOpenShift3Connection(connectionReq.getConnection()).refresh();
    explorer.getOpenShift3Connection(connectionReq.getConnection()).getProject(projectReq.getProjectName()).getServicesWithName("eap-app").get(0).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_ADAPTER_FROM_EXPLORER).select();
    new DefaultShell(OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS);
    assertTrue("Service should be preselected for new OpenShift 3 server adapter", new DefaultTreeItem(projectReq.getProjectName(), "eap-app deploymentConfig=eap-app").isSelected());
    assertTrue("Eclipse project should be preselected automatically for new server adapter", new LabeledText("Eclipse Project: ").getText().equals(PROJECT_NAME));
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(""));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG, false);
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, "eap-app", "Service").test());
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 4 with ServerAdapterExists

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

the class NodeJSAppDebugTest method setUp.

@Before
public void setUp() {
    TestUtils.setUpOcBinary();
    TestUtils.cleanupGitFolder(OpenShiftResources.NODEJS_GIT_NAME);
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    this.connection = explorer.getOpenShift3Connection(requiredConnection.getConnection());
    this.project = connection.getProject(requiredProject.getProjectName());
    this.project.expand();
    // import application
    this.project.getService(OpenShiftResources.NODEJS_SERVICE).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select();
    new DefaultShell(OpenShiftLabel.Shell.IMPORT_APPLICATION);
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION));
    // setup server adapter
    explorer.activate();
    this.project.getService(OpenShiftResources.NODEJS_SERVICE).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_ADAPTER_FROM_EXPLORER).select();
    new DefaultShell(OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS);
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(""), TimePeriod.LONG);
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE, "Service").test());
    // restart in debug
    this.adapter = new ServerAdapter(Version.OPENSHIFT3, OpenShiftResources.NODEJS_SERVICE, "Service");
    this.adapter.select();
    new ContextMenuItem("Restart in Debug").select();
    new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) Before(org.junit.Before)

Aggregations

WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)4 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)4 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)4 ServerAdapterExists (org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists)4 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)3 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)3 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)2 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)2 ServerAdapter (org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter)2 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)1 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 DefaultStyledText (org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)1 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)1 JobIsKilled (org.eclipse.reddeer.workbench.core.condition.JobIsKilled)1 StringContains (org.hamcrest.core.StringContains)1 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)1 Before (org.junit.Before)1 Test (org.junit.Test)1