use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-hibernate by jbosstools.
the class ConnectionProfileFactory method deleteAllConnectionProfiles.
/**
* Method deletes all connection profiles via Data Source Explorer
*/
public static void deleteAllConnectionProfiles() {
DataSourceExplorerView dse = new DataSourceExplorerView();
dse.open();
List<TreeItem> items = new DefaultTreeItem("Database Connections").getItems();
for (TreeItem i : items) {
i.select();
new ContextMenuItem("Delete").select();
;
Shell delete = new DefaultShell("Delete confirmation");
new YesButton(delete).click();
new WaitWhile(new ShellIsAvailable(delete));
}
}
use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem 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");
}
}
use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem 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));
}
use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-hibernate by jbosstools.
the class HQLEditorTest method testHQLEditor.
@Test
public void testHQLEditor() {
prepare();
KnownConfigurationsView v = new KnownConfigurationsView();
v.open();
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 Actor");
hqlEditor.save();
hqlEditor.runHQLQuery();
QueryPageTabView result = new QueryPageTabView();
result.open();
assertTrue("Query result items expected", result.getResultItems().size() > 10);
}
use of org.eclipse.reddeer.swt.impl.menu.ContextMenuItem in project jbosstools-openshift by jbosstools.
the class BrowserIsReadyElseReloadCondition method test.
@Override
public boolean test() {
BrowserEditor browserEditor = null;
try {
browserEditor = new BrowserEditor(new BaseMatcher<String>() {
@Override
public boolean matches(Object arg0) {
return true;
}
@Override
public void describeTo(Description arg0) {
// TODO Auto-generated method stub
}
});
} catch (CoreLayerException ex) {
LOGGER.debug("CoreLayerException in waiting for browser in BrowserIsReadyElseReloadCondition");
LOGGER.debug(StackTraceUtils.stackTraceToString(ex));
return false;
}
String text = browserEditor.getText();
if (text.contains("Unable to load page") || text.contains("404")) {
LOGGER.debug("Refreshing browser");
new ServersView2().open();
serverAdapter.select();
new ContextMenuItem("Show In", "Web Browser").select();
return false;
} else {
// Browser is ready
return true;
}
}
Aggregations