use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class MappingFileTest method prepare.
@Before
public void prepare() {
importMavenProject(PRJ);
try {
Path dogLocation = new File("resources/classes/Dog.java").toPath();
Path ownerLocation = new File("resources/classes/Owner.java").toPath();
new File("target/" + PRJ + "/src/main/java/org/test").mkdirs();
Files.copy(dogLocation, new FileOutputStream("target/" + PRJ + "/src/main/java/org/test/Dog.java"));
Files.copy(ownerLocation, new FileOutputStream("target/" + PRJ + "/src/main/java/org/test/Owner.java"));
new File("target/" + PRJ + "/src/main/java/org/test/clazz").mkdirs();
Path ownerClazzLocation = new File("resources/classes/Owner.javaclazz").toPath();
Files.copy(ownerClazzLocation, new FileOutputStream("target/" + PRJ + "/src/main/java/org/test/clazz/Owner.java"));
} catch (IOException e) {
e.printStackTrace();
fail("Unable to find pom " + PRJ);
}
ProjectExplorer pe = new ProjectExplorer();
pe.open();
pe.getProject(PRJ).refresh();
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer 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.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class MappingFileTest method createMappingFileWithNoConfig.
// JBIDE-21766
@Test
public void createMappingFileWithNoConfig() {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
PropertyDialog pd = pe.getProject(PRJ).openProperties();
pd.select("Hibernate Settings");
new DefaultCombo(pd).setSelection("<None>");
pd.ok();
createMappingFileFromFile();
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class PersistenceXMLFileTest method prepare.
private void prepare() {
importProject(prj, null);
ProjectExplorer pe = new ProjectExplorer();
pe.open();
PropertyDialog pd = pe.getProject(prj).openProperties();
FacetsPropertyPage fp = new FacetsPropertyPage(pd);
pd.select(fp);
List<TreeItem> facets = fp.getSelectedFacets();
boolean javaFacet = false;
boolean jpaFacet = false;
for (TreeItem facet : facets) {
if (facet.getText().equals("Java")) {
javaFacet = true;
} else if (facet.getText().equals("JPA")) {
jpaFacet = true;
}
}
if (!javaFacet) {
fp.selectFacet("Java");
new DefaultHyperlink(pd).activate();
Shell s = new DefaultShell("Modify Faceted Project");
new OkButton(s).click();
new WaitWhile(new ShellIsAvailable(s));
}
if (!jpaFacet) {
fp.selectFacet("JPA");
new DefaultHyperlink(pd).activate();
Shell s = new DefaultShell("Modify Faceted Project");
new NextButton(s).click();
JpaFacetInstallPage installPage = new JpaFacetInstallPage(s);
installPage.setPlatform("Hibernate (JPA 2.1)");
installPage.setJpaImplementation("Disable Library Configuration");
new OkButton(s).click();
new WaitWhile(new ShellIsAvailable(s));
}
pd.ok();
}
use of org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer in project jbosstools-hibernate by jbosstools.
the class ProjectUtils method getItem.
public static ProjectItem getItem(String project, String pckg, String clazz) {
ProjectExplorer pe = new ProjectExplorer();
pe.open();
if (pe.getProject(project).containsResource("Java Resources")) {
return pe.getProject(project).getProjectItem("Java Resources", "src/main/java", pckg, clazz);
}
return pe.getProject(project).getProjectItem("src/main/java", pckg, clazz);
}
Aggregations