Search in sources :

Example 6 with PackageExplorerPart

use of org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart in project jbosstools-hibernate by jbosstools.

the class CodeGenerationKeyWordsTest method checkGeneratedEntities.

private void checkGeneratedEntities(String src) {
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    try {
        new WaitUntil(new EntityIsGenerated(prj, src, "org.gen", "Actor.java"));
        pe.getProject(prj).getProjectItem(src, "org.gen", "Actor.java").open();
    } catch (RedDeerException e) {
        fail("Entities not generated, possible cause https://issues.jboss.org/browse/JBIDE-19217");
    }
    TextEditor actorEditor = new TextEditor("Actor.java");
    assertTrue(actorEditor.getText().contains("implements_"));
    for (Marker m : actorEditor.getMarkers()) {
        if (m.getType().equals("org.eclipse.jdt.ui.error")) {
            fail("Actor has error markers");
        }
    }
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) EntityIsGenerated(org.jboss.tools.hibernate.reddeer.condition.EntityIsGenerated) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) Marker(org.eclipse.reddeer.workbench.impl.editor.Marker) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 7 with PackageExplorerPart

use of org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationFileTest method checkFile.

private void checkFile(boolean generateConsole) {
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.getProject(prjName).getProjectItem("src", HIBERNATE_CFG_FILE).open();
    new DefaultEditor(HIBERNATE_CFG_FILE);
    if (generateConsole) {
        KnownConfigurationsView v = new KnownConfigurationsView();
        v.selectConsole(prjName);
    }
}
Also used : KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)

Example 8 with PackageExplorerPart

use of org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart in project jbosstools-hibernate by jbosstools.

the class EntityValidationTest method userIdentifierGeneratorValidationTest.

// known issue JBIDE-19526
@Test(expected = HibernateTestException.class)
public void userIdentifierGeneratorValidationTest() {
    ProblemsView pv = new ProblemsView();
    pv.open();
    List<Problem> problems = pv.getProblems(ProblemType.ERROR);
    assertTrue(problems.isEmpty());
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.getProject(PROJECT_NAME).getProjectItem("src/main/java", "org.hibernate.ui.test.model", "UserIdGenerator.java").delete();
    try {
        ScreenshotCapturer.getInstance().captureScreenshot("entity_validation");
    } catch (CaptureScreenshotException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    pv.activate();
    String expectedProblem = "Strategy class \"org.hibernate.ui.test.model.UserIdGenerator\" could not be found.";
    new WaitUntil(new ProblemExists(ProblemType.ERROR, new MarkerDescriptionMatcher(expectedProblem)), TimePeriod.DEFAULT, false);
    problems = pv.getProblems(ProblemType.ERROR, new MarkerDescriptionMatcher(expectedProblem));
    if (problems.size() != 1) {
        throw new HibernateTestException();
    }
}
Also used : ProblemExists(org.eclipse.reddeer.eclipse.condition.ProblemExists) CaptureScreenshotException(org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException) Problem(org.eclipse.reddeer.eclipse.ui.problems.Problem) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) MarkerDescriptionMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView) HibernateTestException(org.jboss.tools.hibernate.ui.bot.test.HibernateTestException) Test(org.junit.Test)

Example 9 with PackageExplorerPart

use of org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart in project jbosstools-hibernate by jbosstools.

the class EntityValidationTest method embeddedEntityValidationTest.

@Test
public void embeddedEntityValidationTest() {
    ProblemsView pv = new ProblemsView();
    pv.open();
    List<Problem> problems = pv.getProblems(ProblemType.ERROR);
    assertTrue(problems.isEmpty());
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.getProject(PROJECT_NAME).getProjectItem("src/main/java", "org.hibernate.ui.test.model", "Address.java").delete();
    pv.activate();
    String expectedProblem = "org.hibernate.ui.test.model.Address is not mapped as an embeddable";
    new WaitUntil(new ProblemExists(ProblemType.ERROR, new MarkerDescriptionMatcher(expectedProblem)));
    problems = pv.getProblems(ProblemType.ERROR, new MarkerDescriptionMatcher(expectedProblem));
    assertTrue(expectedProblem + " error is expected", problems.size() == 2);
}
Also used : ProblemExists(org.eclipse.reddeer.eclipse.condition.ProblemExists) Problem(org.eclipse.reddeer.eclipse.ui.problems.Problem) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) MarkerDescriptionMatcher(org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView) Test(org.junit.Test)

Example 10 with PackageExplorerPart

use of org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart in project jbosstools-hibernate by jbosstools.

the class AntFileExportTest method testAntFilenameExport.

@Test
public void testAntFilenameExport() {
    HibernatePerspective p = new HibernatePerspective();
    p.open();
    LaunchConfigurationsDialog launchDialog = new LaunchConfigurationsDialog();
    launchDialog.open();
    launchDialog.selectHibernateCodeGeneration(GEN_NAME);
    launchDialog.selectConfiguration(PRJ);
    launchDialog.apply();
    launchDialog.close();
    PackageExplorerPart pe = new PackageExplorerPart();
    pe.open();
    pe.selectProjects(PRJ);
    ExportAntCodeGenWizard w = new ExportAntCodeGenWizard();
    w.open();
    ExportAntCodeGenWizardPage page = new ExportAntCodeGenWizardPage(w);
    page.setHibernateGenConfiguration(GEN_NAME);
    page.setAntFileName(ANTFILE_NAME);
    w.finish();
    pe.open();
    pe.getProject(PRJ).getProjectItem(ANTFILE_NAME).open();
    assertTrue("Ant file cannot be ampty", new TextEditor(ANTFILE_NAME).getText().length() > 0);
}
Also used : ExportAntCodeGenWizardPage(org.jboss.tools.hibernate.reddeer.codegen.ExportAntCodeGenWizardPage) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) HibernatePerspective(org.jboss.tools.hibernate.reddeer.perspective.HibernatePerspective) ExportAntCodeGenWizard(org.jboss.tools.hibernate.reddeer.codegen.ExportAntCodeGenWizard) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) LaunchConfigurationsDialog(org.jboss.tools.hibernate.reddeer.dialog.LaunchConfigurationsDialog) Test(org.junit.Test)

Aggregations

PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)10 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)6 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)4 DefaultEditor (org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)4 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)3 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)3 EntityIsGenerated (org.jboss.tools.hibernate.reddeer.condition.EntityIsGenerated)3 Test (org.junit.Test)3 ProblemExists (org.eclipse.reddeer.eclipse.condition.ProblemExists)2 MarkerDescriptionMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher)2 Problem (org.eclipse.reddeer.eclipse.ui.problems.Problem)2 ProblemsView (org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)2 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)2 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)2 TextEditor (org.eclipse.reddeer.workbench.impl.editor.TextEditor)2 RegexMatcher (org.eclipse.reddeer.common.matcher.RegexMatcher)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 WithTextMatcher (org.eclipse.reddeer.core.matcher.WithTextMatcher)1 ConsoleHasNoChange (org.eclipse.reddeer.eclipse.condition.ConsoleHasNoChange)1 CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)1