Search in sources :

Example 16 with OpenShift3Connection

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

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

the class CreateApplicationOnBuilderImageTest method tearDown.

@After
public void tearDown() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.reopen();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    connection.getProject().delete();
    ProjectExplorer projectExplorer = new ProjectExplorer();
    if (projectExplorer.containsProject(projectName)) {
        projectExplorer.getProject(projectName).delete();
    }
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) After(org.junit.After)

Example 18 with OpenShift3Connection

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

the class CDKServerAdapterAbstractTest method testOpenshiftConnection.

/**
 * Tests Openshift 3 connection and try to refresh it
 *
 * @param connection
 */
public void testOpenshiftConnection(String server, String username) {
    OpenShift3Connection connection = null;
    try {
        connection = findOpenShiftConnection(server, username);
    } catch (OpenShiftToolsException toolsExc) {
        fail(toolsExc.getMessage());
    }
    // usually, when server adapter is not started, openshift connection after refresh should cause
    // problem occurred dialog
    connection.refresh();
    try {
        // $NON-NLS-1$
        new WaitUntil(new ShellIsAvailable("Problem occurred"), TimePeriod.getCustom(30));
        CDKUtils.captureScreenshot("CDKServerAdapterAbstractTest#testOpenshiftConnection");
        new DefaultShell("Problem occurred").close();
        // $NON-NLS-1$
        fail("Problem dialog occured when refreshing OpenShift connection");
    } catch (WaitTimeoutExpiredException ex) {
        // no dialog appeared, which is ok
        // $NON-NLS-1$
        log.info("Expected WaitTimeoutExpiredException occured");
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)

Example 19 with OpenShift3Connection

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

the class DeleteProjectTest method testDeleteProjectViaManageProjectsShell.

@Test
public void testDeleteProjectViaManageProjectsShell() {
    projectExists = true;
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    connection.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.EDIT_OS_PROJECTS).select();
    new DefaultShell(OpenShiftLabel.Shell.MANAGE_OS_PROJECTS);
    new DefaultTable().getItem(PROJECT_NAME).select();
    new PushButton(OpenShiftLabel.Button.REMOVE).click();
    new DefaultShell(OpenShiftLabel.Shell.DELETE_RESOURCE);
    new OkButton().click();
    projectExists = false;
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.DELETE_OS_PROJECT), TimePeriod.LONG);
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    new WaitUntil(new ControlIsEnabled(new PushButton("Refresh...")), TimePeriod.DEFAULT);
    new PushButton("Refresh...").click();
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    new WaitUntil(new ProjectDoesNotExistInManageOSProject(new DefaultShell(OpenShiftLabel.Shell.MANAGE_OS_PROJECTS), PROJECT_NAME), TimePeriod.LONG);
    assertFalse("There should not be present project in the table.", new DefaultTable().containsItem(PROJECT_NAME));
    new OkButton().click();
    new WaitWhile(new ShellIsAvailable(OpenShiftLabel.Shell.MANAGE_OS_PROJECTS), TimePeriod.LONG);
    assertFalse("Project is still presented in OpenShift explorer under a connection.", connection.projectExists(PROJECT_NAME));
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultTable(org.eclipse.reddeer.swt.impl.table.DefaultTable) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 20 with OpenShift3Connection

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

the class ConnectionPropertiesTest method testConnectionProperties.

@Test
public void testConnectionProperties() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    OpenShift3Connection connection = explorer.getOpenShift3Connection(connectionReq.getConnection());
    connection.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.PROPERTIES).select();
    PropertySheet propertiesView = new PropertySheet();
    propertiesView.activate();
    assertEquals("Property host is not valid. Was '" + propertiesView.getProperty(PROPERTY_HOST).getPropertyValue() + "' but was expected '" + DatastoreOS3.SERVER + "'", DatastoreOS3.SERVER, propertiesView.getProperty(PROPERTY_HOST).getPropertyValue());
    if (DatastoreOS3.AUTH_METHOD.equals(AuthenticationMethod.BASIC)) {
        assertEquals("Property user name is not valid. Was '" + propertiesView.getProperty(PROPERTY_USERNAME).getPropertyValue() + "' but was expected '" + DatastoreOS3.USERNAME + "'", DatastoreOS3.USERNAME, propertiesView.getProperty(PROPERTY_USERNAME).getPropertyValue());
    } else {
        assertEquals("Property user name is not valid. Was '" + propertiesView.getProperty(PROPERTY_USERNAME).getPropertyValue() + "' but was expected '" + connectionReq.getConnection().getUsername() + "'", connectionReq.getConnection().getUsername(), propertiesView.getProperty(PROPERTY_USERNAME).getPropertyValue());
    }
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) PropertySheet(org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) OpenShift3Connection(org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Aggregations

OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)21 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)19 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)8 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)7 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)7 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)7 Test (org.junit.Test)7 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)5 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)5 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)5 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)5 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)3 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)3 After (org.junit.After)3 ProjectExplorer (org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer)2 PropertySheet (org.eclipse.reddeer.eclipse.ui.views.properties.PropertySheet)2 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)2 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)2