Search in sources :

Example 1 with NewCDKServerWizard

use of org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard in project jbosstools-openshift by jbosstools.

the class CDK3ServerWizardTest method testNewCDK3ServerWizard.

@Test
public void testNewCDK3ServerWizard() {
    NewCDKServerWizard dialog = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    NewServerWizardPage page = new NewServerWizardPage(dialog);
    page.selectType(SERVER_TYPE_GROUP, CDK3_SERVER_NAME);
    page.setName(getServerAdapter());
    dialog.next();
    NewCDK3ServerWizardPage containerPage = new NewCDK3ServerWizardPage();
    checkWizardPagewidget("Minishift Binary: ", CDK3_SERVER_NAME);
    // just check that default domain is choosen correctly
    assertTrue(containerPage.getDomain().equalsIgnoreCase(CREDENTIALS_DOMAIN));
    // needs to activate validator
    containerPage.setMinishiftBinary(EXISTING_PATH);
    // first the credentials are checked
    assertSameMessage(dialog, NO_USER);
    containerPage.setCredentials(USERNAME, PASSWORD);
    assertDiffMessage(dialog, NO_USER);
    // checking of minishift binary validation
    // test that existing folder cannot be run
    containerPage.setMinishiftBinary(EXISTING_PATH);
    assertSameMessage(dialog, CANNOT_RUN_PROGRAM);
    containerPage.setMinishiftBinary(NON_EXECUTABLE_FILE);
    assertSameMessage(dialog, NOT_EXECUTABLE);
    containerPage.setMinishiftBinary(NON_EXISTING_PATH);
    assertSameMessage(dialog, DOES_NOT_EXIST);
    containerPage.setMinishiftBinary(EXECUTABLE_FILE);
    assertSameMessage(dialog, CHECK_MINISHIFT_VERSION);
    // check compatibility of cdk version with server adapter
    containerPage.setMinishiftBinary(MOCK_CDK320);
    assertSameMessage(dialog, NOT_COMPATIBLE);
    // Positive test of proper minishift binary
    containerPage.setMinishiftBinary(MINISHIFT_PATH);
    assertDiffMessage(dialog, CHECK_MINISHIFT_VERSION);
    new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.MEDIUM, false);
    assertTrue("Expected Finish button is not enabled", dialog.isFinishEnabled());
    dialog.cancel();
}
Also used : FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) NewCDK3ServerWizardPage(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDK3ServerWizardPage) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) NewServerWizardPage(org.eclipse.reddeer.eclipse.wst.server.ui.wizard.NewServerWizardPage) Test(org.junit.Test)

Example 2 with NewCDKServerWizard

use of org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard in project jbosstools-openshift by jbosstools.

the class CDKTestUtils method openNewServerWizardDialog.

public static NewCDKServerWizard openNewServerWizardDialog() {
    // $NON-NLS-1$
    log.info("Adding new Container Development Environment server adapter");
    // call new server dialog from servers view
    CDKServersView view = new CDKServersView();
    view.open();
    NewCDKServerWizard dialog = view.newCDKServer();
    new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
    return dialog;
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) CDKServersView(org.jboss.tools.cdk.reddeer.server.ui.CDKServersView) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard)

Example 3 with NewCDKServerWizard

use of org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard in project jbosstools-openshift by jbosstools.

the class CDKServerWizardAbstractTest method assertServerType.

protected void assertServerType(final String serverType) {
    NewCDKServerWizard wizard = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    try {
        TreeItem item = new DefaultTreeItem(new String[] { SERVER_TYPE_GROUP }).getItem(serverType);
        item.select();
        assertTrue(item.getText().equalsIgnoreCase(serverType));
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
    } catch (CoreLayerException coreExp) {
        log.error(coreExp.getMessage());
        fail("Server type " + serverType + " was not found in New Server Wizard");
    }
    assertEquals(new LabeledText("Server's host name:").getText(), "localhost");
    assertEquals(new LabeledText("Server name:").getText(), getServerAdapter());
    new WaitUntil(new ControlIsEnabled(new NextButton()), TimePeriod.MEDIUM, false);
    assertTrue("Dialog button Next is not enabled!", wizard.isNextEnabled());
    try {
        new WaitWhile(new JobIsRunning(), TimePeriod.MEDIUM, false);
        new CancelButton().click();
    } catch (WaitTimeoutExpiredException exc) {
        exc.printStackTrace();
        log.error("Dialog could not be canceled because there were unfinished jobs running after timeout" + "\n\rTrying to cancel dialog manually");
        new DefaultShell("New Server").close();
    }
}
Also used : NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) SystemJobIsRunning(org.jboss.tools.cdk.reddeer.core.condition.SystemJobIsRunning) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) CoreLayerException(org.eclipse.reddeer.core.exception.CoreLayerException)

Example 4 with NewCDKServerWizard

use of org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method addNewCDK32Server.

/**
 * Creates new CDK 3.2+ server adapter via ServersView -> New -> Server
 *
 * @param serverAdapter server adapter name
 * @param hypervisor hypervisor to use
 * @param path path to minishift binary file
 * @param profile what profile to use
 * @param username redhat developers username
 * @param password user password
 */
public static void addNewCDK32Server(String serverAdapter, String hypervisor, String path, String profile, String username, String password) {
    NewCDKServerWizard dialog = setupFirstNewServerWizardPage(CDK32_SERVER_NAME, serverAdapter);
    // set second new server dialog page
    NewCDK32ServerWizardPage containerPage = new NewCDK32ServerWizardPage();
    containerPage.setCredentials(username, password);
    if (hypervisor != null && !hypervisor.isEmpty()) {
        // $NON-NLS-1$
        log.info("Setting hypervisor to " + hypervisor);
        containerPage.setHypervisor(hypervisor);
    }
    // $NON-NLS-1$
    log.info("Setting minishift binary file folder to " + path);
    containerPage.setMinishiftBinary(path);
    if (!profile.isEmpty()) {
        // $NON-NLS-1$
        log.info("Setting minishift profile to " + profile);
        containerPage.setMinishiftProfile(profile);
    } else {
        log.info("Keeping minishift profile default: " + containerPage.getMinishiftProfile());
    }
    new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.DEFAULT);
    // $NON-NLS-1$
    log.info("Finishing Add new server dialog");
    if (!(new FinishButton().isEnabled())) {
        // $NON-NLS-1$
        log.error("Finish button was not enabled");
    }
    dialog.finish();
}
Also used : NewCDK32ServerWizardPage(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDK32ServerWizardPage) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 5 with NewCDKServerWizard

use of org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard in project jbosstools-openshift by jbosstools.

the class CDKServerAdapterAbstractTest method addNewMinishiftServer.

/**
 * Creates new Minishift server adapter via ServersView -> New -> Server
 *
 * @param serverAdapter server adapter name
 * @param hypervisor hypervisor to use
 * @param path path to minishift binary file
 * @param profile what profile to use
 */
public static void addNewMinishiftServer(String serverAdapter, String hypervisor, String path, String profile) {
    NewCDKServerWizard dialog = setupFirstNewServerWizardPage(MINISHIFT_SERVER_NAME, serverAdapter);
    // set second new server dialog page
    NewMinishiftServerWizardPage containerPage = new NewMinishiftServerWizardPage();
    if (!StringUtils.isEmptyOrNull(hypervisor)) {
        // $NON-NLS-1$
        log.info("Setting hypervisor to " + hypervisor);
        containerPage.setHypervisor(hypervisor);
    }
    // $NON-NLS-1$
    log.info("Setting minishift binary file folder to " + path);
    containerPage.setMinishiftBinary(path);
    // $NON-NLS-1$
    log.info("Setting minishift profile to " + profile);
    containerPage.setMinishiftProfile(profile);
    new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.DEFAULT);
    // $NON-NLS-1$
    log.info("Finishing Add new server dialog");
    if (!(new FinishButton().isEnabled())) {
        // $NON-NLS-1$
        log.error("Finish button was not enabled");
    }
    dialog.finish(TimePeriod.MEDIUM);
}
Also used : NewMinishiftServerWizardPage(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewMinishiftServerWizardPage) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Aggregations

NewCDKServerWizard (org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard)11 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)9 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)9 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)8 NewServerWizardPage (org.eclipse.reddeer.eclipse.wst.server.ui.wizard.NewServerWizardPage)4 Test (org.junit.Test)3 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 NewCDK32ServerWizardPage (org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDK32ServerWizardPage)2 NewCDK3ServerWizardPage (org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDK3ServerWizardPage)2 NewMinishiftServerWizardPage (org.jboss.tools.cdk.reddeer.server.ui.wizard.NewMinishiftServerWizardPage)2 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)1 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)1 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)1 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)1 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)1 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)1