Search in sources :

Example 1 with KnownConfigurationsView

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

the class ConsoleConfigurationTest method clean.

@After
public void clean() {
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    v.deleteConsoleConfiguration(CONSOLE_NAME);
    deleteAllProjects();
}
Also used : KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) After(org.junit.After)

Example 2 with KnownConfigurationsView

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

the class ConsoleConfigurationTest method prepareConsoleConfiguration.

public void prepareConsoleConfiguration(String hibernateVersion) {
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    EditConfigurationShell s = v.addConfiguration();
    s.setName(CONSOLE_NAME);
    EditConfigurationMainPage p = s.getMainPage();
    p.setProject(prjName);
    p.setDatabaseConnection(PredefinedConnection.HIBERNATE_CONFIGURED_CONNECTION);
    p.setConfigurationFile("/" + prjName + "/" + HIBERNATE_CFG_FILE);
    p.setHibernateVersion(hibernateVersion);
    // ANY ERROR IN WIZARD ??
    s.ok();
    v.open();
    EditConfigurationShell s2 = v.openConsoleConfiguration(CONSOLE_NAME);
    s2.close();
    v.open();
    try {
        v.selectNode(CONSOLE_NAME, "Database", "SAKILA.PUBLIC", "ACTOR");
    } catch (WaitTimeoutExpiredException e) {
        log.info("Wait timeout occured, try rebuilding console config");
        v.selectConsole(CONSOLE_NAME);
        new ContextMenuItem("Rebuild configuration").select();
        new WaitWhile(new JobIsRunning());
        v.selectNode(CONSOLE_NAME, "Database", "SAKILA.PUBLIC", "ACTOR");
    }
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) EditConfigurationShell(org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) EditConfigurationMainPage(org.jboss.tools.hibernate.reddeer.console.EditConfigurationMainPage) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 3 with KnownConfigurationsView

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

the class CriteriaEditorCodeAssistTest method prepareMaven.

private void prepareMaven() {
    prepareMvn(prj, hbVersion);
    DatabaseConfiguration cfg = dbRequirement.getConfiguration();
    ProjectConfigurationFactory.setProjectFacetForDB(prj, cfg, jpaVersion);
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    List<TreeItem> confs = v.getConsoleConfigurations();
    if (confs != null) {
        for (TreeItem i : confs) {
            v.deleteConsoleConfiguration(i.getText());
        }
    }
    EditConfigurationShell confShell = v.addConfiguration();
    confShell.setName(prj);
    EditConfigurationMainPage mainPage = confShell.getMainPage();
    mainPage.setProject(prj);
    mainPage.setType("JPA (jdk 1.5+)");
    mainPage.setDatabaseConnection("[JPA Project Configured Connection]");
    mainPage.setHibernateVersion(hbVersion);
    confShell.ok();
}
Also used : DatabaseConfiguration(org.eclipse.reddeer.requirements.db.DatabaseConfiguration) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) EditConfigurationShell(org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell) EditConfigurationMainPage(org.jboss.tools.hibernate.reddeer.console.EditConfigurationMainPage) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView)

Example 4 with KnownConfigurationsView

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

the class CriteriaEditorTest method prepareMaven.

private void prepareMaven() {
    prepareMvn(prj, hbVersion);
    DatabaseConfiguration cfg = dbRequirement.getConfiguration();
    ProjectConfigurationFactory.setProjectFacetForDB(prj, cfg, jpaVersion);
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    List<TreeItem> confs = v.getConsoleConfigurations();
    if (confs != null) {
        for (TreeItem i : confs) {
            v.deleteConsoleConfiguration(i.getText());
        }
    }
    EditConfigurationShell confShell = v.addConfiguration();
    confShell.setName(prj);
    EditConfigurationMainPage mainPage = confShell.getMainPage();
    mainPage.setProject(prj);
    mainPage.setType("JPA (jdk 1.5+)");
    mainPage.setDatabaseConnection("[JPA Project Configured Connection]");
    mainPage.setHibernateVersion(hbVersion);
    confShell.ok();
}
Also used : DatabaseConfiguration(org.eclipse.reddeer.requirements.db.DatabaseConfiguration) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) EditConfigurationShell(org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell) EditConfigurationMainPage(org.jboss.tools.hibernate.reddeer.console.EditConfigurationMainPage) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView)

Example 5 with KnownConfigurationsView

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

the class HQLEditorCodeAssistTest method testHQLEditor.

@Test
public void testHQLEditor() {
    prepare();
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    v.selectConsole(prj);
    EditConfigurationShell confShell = v.openConsoleConfiguration(prj);
    EditConfigurationMainPage mainPage = confShell.getMainPage();
    mainPage.setProject(prj);
    mainPage.setType("JPA (jdk 1.5+)");
    mainPage.setDatabaseConnection("[JPA Project Configured Connection]");
    mainPage.setHibernateVersion(hbVersion);
    confShell.ok();
    v.open();
    v.selectConsole(prj);
    new ContextMenuItem("HQL Editor").select();
    HQLEditor hqlEditor = new HQLEditor(prj);
    hqlEditor.setText("from ");
    hqlEditor.setCursorPosition("from ".length());
    String proposal = "Actor - org.gen";
    ContentAssistant ca = hqlEditor.openContentAssistant();
    List<String> proposals = ca.getProposals();
    ca.close();
    assertTrue(proposal + " is expected", proposals.contains(proposal));
    hqlEditor.setText("from Actor a where a.");
    hqlEditor.setCursorPosition("from Actor a where a.".length());
    proposal = "actorId - Actor";
    ca = hqlEditor.openContentAssistant();
    proposals = ca.getProposals();
    ca.close();
    assertTrue(proposal + " is expected", proposals.contains(proposal));
}
Also used : ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) EditConfigurationShell(org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell) EditConfigurationMainPage(org.jboss.tools.hibernate.reddeer.console.EditConfigurationMainPage) HQLEditor(org.jboss.tools.hibernate.reddeer.hqleditor.HQLEditor) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) ContentAssistant(org.eclipse.reddeer.jface.text.contentassist.ContentAssistant) Test(org.junit.Test)

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