use of org.jboss.tools.hibernate.reddeer.jdt.ui.wizards.NewHibernateMappingPreviewPage in project jbosstools-hibernate by jbosstools.
the class MappingFileTest method createMappingFileFromPackage.
@Test
public void createMappingFileFromPackage() {
ProjectUtils.getPackage(PRJ, PCKG).select();
NewHibernateMappingFileWizard wizard = new NewHibernateMappingFileWizard();
wizard.open();
NewHibernateMappingElementsSelectionPage2 selPage = new NewHibernateMappingElementsSelectionPage2(wizard);
selPage.selectItem(PCKG);
wizard.next();
NewHibernateMappingFilePage files = new NewHibernateMappingFilePage(wizard);
assertEquals(2, files.getClasses().size());
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, "Dog.hbm.xml"));
ProjectUtils.getItem(PRJ, PCKG, "Dog.hbm.xml").open();
Hibernate3CompoundEditor hme = new Hibernate3CompoundEditor("Dog.hbm.xml");
hme.activateSourceTab();
String sourceText = hme.getSourceText();
XPathHelper xph = XPathHelper.getInstance();
String table = xph.getMappingFileTable(PCKG + ".Dog", sourceText);
assertTrue(table.equals("DOG"));
ProjectUtils.getItem(PRJ, PCKG, "Owner.hbm.xml").open();
hme = new Hibernate3CompoundEditor("Owner.hbm.xml");
hme.activateSourceTab();
sourceText = hme.getSourceText();
table = xph.getMappingFileTable(PCKG + ".Owner", sourceText);
assertEquals("OWNER", table);
}
use of org.jboss.tools.hibernate.reddeer.jdt.ui.wizards.NewHibernateMappingPreviewPage 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);
}
Aggregations