Search in sources :

Example 71 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-hibernate by jbosstools.

the class CriteriaEditorCodeAssistTest method checkCriteriaEditor.

private void checkCriteriaEditor() {
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    v.selectConsole(prj);
    new ContextMenuItem("Hibernate Criteria Editor").select();
    String expression = "ses";
    CriteriaEditor criteriaEditor = new CriteriaEditor(prj);
    criteriaEditor.setText(expression);
    criteriaEditor.setCursorPosition(expression.length());
    String proposal = "session : Session";
    ContentAssistant ca = criteriaEditor.openContentAssistant();
    List<String> proposals = ca.getProposals();
    ca.close();
    assertTrue(proposal + " is expected", proposals.contains(proposal));
    expression = "session.cre";
    criteriaEditor.setText(expression);
    criteriaEditor.setCursorPosition(expression.length());
    proposal = "createCriteria\\(Class arg0\\) \\: Criteria \\- Session";
    Double hv = Double.parseDouble(hbVersion);
    if (hv >= 4.0) {
        proposal = "createCriteria\\(Class \\w*\\) : Criteria - SharedSessionContract";
    }
    ca = criteriaEditor.openContentAssistant();
    proposals = ca.getProposals();
    ca.close();
    boolean shouldFail = true;
    for (String p : proposals) {
        if (p.matches(proposal)) {
            shouldFail = false;
            break;
        }
    }
    if (shouldFail) {
        fail(proposal + " CA proposal is expected but was " + proposals);
    }
    expression = "session.createCriteria(Act";
    criteriaEditor.setText(expression);
    criteriaEditor.setCursorPosition(expression.length());
    proposal = "Actor - org.gen";
    ca = criteriaEditor.openContentAssistant();
    proposals = ca.getProposals();
    ca.close();
    assertTrue(proposal + " is expected", proposals.contains(proposal));
}
Also used : CriteriaEditor(org.jboss.tools.hibernate.reddeer.criteriaeditor.CriteriaEditor) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) ContentAssistant(org.eclipse.reddeer.jface.text.contentassist.ContentAssistant)

Example 72 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-hibernate by jbosstools.

the class CriteriaEditorTest method checkCriteriaEditor.

private void checkCriteriaEditor() {
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    v.selectConsole(prj);
    new ContextMenuItem("Hibernate Criteria Editor").select();
    CriteriaEditor criteriaEditor = new CriteriaEditor(prj);
    criteriaEditor.setText("session.createCriteria(Actor.class).list();");
    criteriaEditor.save();
    criteriaEditor.runCriteria();
    QueryPageTabView result = new QueryPageTabView();
    result.open();
    assertTrue("Query result items expected - known issue https://issues.jboss.org/browse/JBIDE-19743", result.getResultItems().size() > 10);
}
Also used : CriteriaEditor(org.jboss.tools.hibernate.reddeer.criteriaeditor.CriteriaEditor) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) QueryPageTabView(org.jboss.tools.hibernate.reddeer.console.views.QueryPageTabView)

Example 73 with ContextMenuItem

use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-hibernate by jbosstools.

the class KnownConfigurationsView method deleteConsoleConfiguration.

/**
 * Deletes hibernate console configuration
 * @param console hibernate console configuration name
 */
public void deleteConsoleConfiguration(String console) {
    new DefaultTreeItem(new DefaultTree(this), console).select();
    new ContextMenuItem("Delete Configuration").select();
    Shell deleteShell = new DefaultShell("Delete console configuration");
    new OkButton(deleteShell).click();
    new WaitWhile(new ShellIsAvailable(deleteShell));
    new WaitWhile(new JobIsRunning());
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) DefaultTree(org.eclipse.reddeer.swt.impl.tree.DefaultTree) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) EditConfigurationShell(org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Aggregations

ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)73 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)36 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)36 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)33 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)29 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)29 Test (org.junit.Test)26 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)19 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)17 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)15 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)11 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)11 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)9 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)8 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)8 KnownConfigurationsView (org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView)7 OpenShift3Connection (org.jboss.tools.openshift.reddeer.view.resources.OpenShift3Connection)7 ImportApplicationWizard (org.jboss.tools.openshift.reddeer.wizard.importapp.ImportApplicationWizard)6 CheckBox (org.eclipse.reddeer.swt.impl.button.CheckBox)5 EditConfigurationShell (org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell)5