use of org.jboss.tools.hibernate.reddeer.criteriaeditor.CriteriaEditor 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));
}
use of org.jboss.tools.hibernate.reddeer.criteriaeditor.CriteriaEditor 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);
}
Aggregations