use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class MappingFileTest method createMappingFileFromFile.
@Test
public void createMappingFileFromFile() {
ProjectUtils.getItem(PRJ, PCKG_CLZ, "Owner.java").select();
NewHibernateMappingFileWizard wizard = new NewHibernateMappingFileWizard();
wizard.open();
NewHibernateMappingElementsSelectionPage2 selPage = new NewHibernateMappingElementsSelectionPage2(wizard);
selPage.selectItem("Owner");
wizard.next();
NewHibernateMappingFilePage files = new NewHibernateMappingFilePage(wizard);
files.selectClasses("Owner");
wizard.next();
NewHibernateMappingPreviewPage preview = new NewHibernateMappingPreviewPage(wizard);
assertTrue("Preview text cannot be empty", !preview.getPreviewText().equals(""));
wizard.finish();
ProjectExplorer pe = new ProjectExplorer();
pe.open();
assertTrue("Hbm.xml not generated: Known issue(s): JBIDE-18769, JBIDE-20042", containsItem(PCKG_CLZ, "Owner.hbm.xml"));
ProjectUtils.getItem(PRJ, PCKG_CLZ, "Owner.hbm.xml").open();
String fileName = "Owner.hbm.xml";
Hibernate3CompoundEditor hme = new Hibernate3CompoundEditor(fileName);
hme.activateSourceTab();
String sourceText = hme.getSourceText();
XPathHelper xph = XPathHelper.getInstance();
String table = xph.getMappingFileTable(PCKG_CLZ + ".Owner", sourceText);
assertEquals("OWNER", table);
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class PersistenceXMLFileTest method editPersistenceXMLFile.
@Test
public void editPersistenceXMLFile() {
prepare();
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.getProject(prj).getProjectItem("src", "META-INF", "persistence.xml").open();
JpaXmlEditor pexml = new JpaXmlEditor();
pexml.setHibernateUsername("sa");
pexml.setHibernateDialect("H2");
pexml.save();
String usernameProp = "hibernate.connection.username";
String dialectProp = "hibernate.dialect";
String usernameExpected = "sa";
String dialectExpected = "org.hibernate.dialect.H2Dialect";
XPathHelper xh = XPathHelper.getInstance();
String text = pexml.getSourceText();
String usrnameVal = xh.getPersistencePropertyValue(usernameProp, text);
assertTrue("sa value is expected", usrnameVal.equals(usernameExpected));
String dialectVal = xh.getPersistencePropertyValue(dialectProp, text);
assertTrue("H2 value is expected", dialectVal.equals(dialectExpected));
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class RevengFileTest method testCreateRevengFile.
@Test
public void testCreateRevengFile() {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.selectProjects(PROJECT_NAME);
NewReverseEngineeringFileWizard wizard = new NewReverseEngineeringFileWizard();
wizard.open();
wizard.next();
TableFilterWizardPage page = new TableFilterWizardPage(wizard);
page.setConsoleConfiguration(PROJECT_NAME);
page.refreshDatabaseSchema();
page.pressInclude();
wizard.finish();
ReverseEngineeringEditor re = new ReverseEngineeringEditor();
re.activateDesignTab();
re.activateOverviewTab();
re.activateSourceTab();
re.activateTableFiltersTab();
re.activateTypeMappingsTab();
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class TablesFromJPAEntitiesGeneration method testDDLGeneration.
private void testDDLGeneration(boolean useConsole, String hbVersion, String pkg) {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.selectProjects(prj);
GenerateDdlWizard w = new GenerateDdlWizard();
w.open();
GenerateDdlWizardPage p = new GenerateDdlWizardPage(w);
p.setFileName(DDL_FILE);
p.setUseConsoleConfiguration(useConsole);
if (useConsole) {
assertTrue(p.isConsoleConfigurationEnabled());
assertFalse(p.isHibernateVersionEnabled());
p.setConsoleConfiguration(prj);
}
if (!useConsole) {
assertFalse(p.isConsoleConfigurationEnabled());
assertTrue(p.isHibernateVersionEnabled());
p.setHibernateVersion(hbVersion);
}
w.finish();
pe.open();
try {
ProjectUtils.getPackage(prj, DDL_FILE).open();
} catch (RedDeerException e) {
Assert.fail("DDL is not generated - known issues(s): JBIDE-19431,JBIDE-19535");
}
String ddlText = new TextEditor(DDL_FILE).getText();
assertTrue("DDL file cannot be empty", ddlText.length() > 0);
checkDDLContent(ddlText);
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class ProjectConfigurationFactory method checkPersistenceXML.
/**
* Check persistence.xml
* @param prj project name
*/
public static void checkPersistenceXML(String prj) {
log.info("Open persistence xml file");
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.getProject(prj).getProjectItem("JPA Content", "persistence.xml").open();
log.info("In editor set some hibernate properties on hibernate tab");
JpaXmlEditor pexml = new JpaXmlEditor();
String sourceText = pexml.getSourceText();
pexml.close();
assertTrue("persistence.xml cannot be empty", sourceText.length() > 0);
}
Aggregations