Search in sources :

Example 11 with KnownConfigurationsView

use of org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationFileTest method checkFile.

private void checkFile(boolean generateConsole) {
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.getProject(prjName).getProjectItem("src", HIBERNATE_CFG_FILE).open();
    new DefaultEditor(HIBERNATE_CFG_FILE);
    if (generateConsole) {
        KnownConfigurationsView v = new KnownConfigurationsView();
        v.selectConsole(prjName);
    }
}
Also used : KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)

Example 12 with KnownConfigurationsView

use of org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView 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 13 with KnownConfigurationsView

use of org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView 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 14 with KnownConfigurationsView

use of org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView in project jbosstools-hibernate by jbosstools.

the class HibernateToolsFactory method setHibernateVersion.

/**
 * Sets hibernate version to given console
 * @param consoleName console name
 * @param hibernateVersion hibernate version
 */
public static void setHibernateVersion(String consoleName, String hbVersion) {
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    v.openConsoleConfiguration(consoleName);
    new LabeledCombo("Hibernate Version:").setSelection(hbVersion);
    new OkButton().click();
}
Also used : OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView)

Aggregations

KnownConfigurationsView (org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView)14 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)7 EditConfigurationMainPage (org.jboss.tools.hibernate.reddeer.console.EditConfigurationMainPage)6 EditConfigurationShell (org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell)6 DatabaseConfiguration (org.eclipse.reddeer.requirements.db.DatabaseConfiguration)3 TreeItem (org.eclipse.reddeer.swt.api.TreeItem)3 QueryPageTabView (org.jboss.tools.hibernate.reddeer.console.views.QueryPageTabView)3 Test (org.junit.Test)3 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 ContentAssistant (org.eclipse.reddeer.jface.text.contentassist.ContentAssistant)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 CriteriaEditor (org.jboss.tools.hibernate.reddeer.criteriaeditor.CriteriaEditor)2 HQLEditor (org.jboss.tools.hibernate.reddeer.hqleditor.HQLEditor)2 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)1 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)1 LabeledCombo (org.eclipse.reddeer.swt.impl.combo.LabeledCombo)1 DefaultEditor (org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)1 DynamicSQLPreviewView (org.jboss.tools.hibernate.reddeer.console.views.DynamicSQLPreviewView)1 QueryParametersView (org.jboss.tools.hibernate.reddeer.console.views.QueryParametersView)1