Search in sources :

Example 41 with OpenShiftExplorerView

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

the class AbstractBotTests method cleanUp.

@AfterClass
public static void cleanUp() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    if (connection != null) {
        for (OpenShiftProject project : connection.getAllProjects()) {
            safeDeleteProject(project, connection);
        }
        new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    }
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) OpenShiftProject(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) AfterClass(org.junit.AfterClass)

Example 42 with OpenShiftExplorerView

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

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

the class ImportApplicationBase method init.

@BeforeClass
public static void init() {
    OpenShiftExplorerView openshiftExplorer = new OpenShiftExplorerView();
    openshiftExplorer.open();
    OpenShift3Connection connection = openshiftExplorer.getOpenShift3Connection(requiredConnection.getConnection());
    project = connection.getProject(requiredProject.getProjectName());
    project.expand();
    project.refresh();
    service = (project.getServicesWithName(requiredService.getService().getName())).get(0);
    assertNotNull("OpenShift service '" + OpenShiftResources.NODEJS_SERVICE + "' was not found!", service);
}
Also used : OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) BeforeClass(org.junit.BeforeClass)

Example 44 with OpenShiftExplorerView

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

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

OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)59 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)22 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)19 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)19 OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)19 Test (org.junit.Test)18 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)17 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)17 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)16 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)13 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)11 OpenShiftProject (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftProject)11 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)10 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)9 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)8 OpenShiftResource (org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource)7 Before (org.junit.Before)7 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)6 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)4 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)4