Search in sources :

Example 1 with ProblemsView

use of org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView in project jbosstools-hibernate by jbosstools.

the class JPAProjectFactory method createProject.

/**
 * Creates JPA Project
 * @param prj projec name
 * @param version JPA version
 * @param platform JPA platform
 */
public static void createProject(String prj, String version, String platform) {
    log.step("Open JPA Project Wizard");
    JPAProjectWizard wizard = new JPAProjectWizard();
    wizard.open();
    JPAProjectWizardFirstPage firstPage = new JPAProjectWizardFirstPage(wizard);
    firstPage.setProjectName(prj);
    firstPage.setJPAVersion(version);
    wizard.next();
    wizard.next();
    log.step("Disable hibernate configuration");
    JpaFacetInstallPage facetPage = new JpaFacetInstallPage(wizard);
    facetPage.setPlatform(platform);
    facetPage.setJpaImplementation("Disable Library Configuration");
    log.step("Click finish");
    wizard.finish();
    new WaitWhile(new JobIsRunning());
    ProblemsView problemsView = new ProblemsView();
    problemsView.open();
    List<Problem> allErrors = problemsView.getProblems(ProblemType.ERROR);
    problemsView.open();
    assertTrue("No problems are expected (JBIDE-17855)", allErrors.size() == 0);
}
Also used : JPAProjectWizard(org.jboss.tools.hibernate.reddeer.wizard.JPAProjectWizard) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JPAProjectWizardFirstPage(org.jboss.tools.hibernate.reddeer.wizard.JPAProjectWizardFirstPage) JpaFacetInstallPage(org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage) Problem(org.eclipse.reddeer.eclipse.ui.problems.Problem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)

Example 2 with ProblemsView

use of org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView in project jbosstools-hibernate by jbosstools.

the class ProjectImporter method importProjectWithoutErrors.

/**
 * Import porject and requires no errors in problems log
 * @param pluginId plug-in id of project where project resources are located
 * @param projectName project name to import
 */
public static void importProjectWithoutErrors(String pluginId, String projectName, Map<String, String> libraryPathMap) {
    importProject(pluginId, projectName);
    if (libraryPathMap != null) {
        Map<String, String> fullPathJars = new HashMap<>();
        for (String jar : libraryPathMap.keySet()) {
            if (libraryPathMap.get(jar) == null) {
                fullPathJars.put(jar, LIB_DIR);
            } else {
                fullPathJars.put(jar, LIB_DIR + libraryPathMap.get(jar));
            }
        }
        ProjectHelper.addLibrariesIntoProject(projectName, fullPathJars);
    }
    new WaitUntil(new JobIsRunning(), TimePeriod.SHORT, false);
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    ProblemsView problemsView = new ProblemsView();
    problemsView.open();
    new WaitWhile(new JobIsRunning());
    List<Problem> problems = problemsView.getProblems(ProblemType.ERROR);
    for (Problem p : problems) {
        log.error("Unexpected " + problems.size() + " problem(s):");
        log.dump("Problem: " + p.toString());
    }
    assertTrue("No problems after import are expected", problems.size() == 0);
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) HashMap(java.util.HashMap) Problem(org.eclipse.reddeer.eclipse.ui.problems.Problem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)

Example 3 with ProblemsView

use of org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView in project jbosstools-hibernate by jbosstools.

the class JpaAnnotationGenerationTest method postCheck.

private void postCheck(String clazz) {
    HibernateJPAWizard jpaWizard = new HibernateJPAWizard();
    jpaWizard.next();
    jpaWizard.finish();
    ProjectUtils.getItem(prj, PCKG, clazz + ".java").open();
    TextEditor editor = new TextEditor(clazz + ".java");
    assertTrue(editor.getText().contains("@Entity"));
    ProblemsView pw = new ProblemsView();
    pw.open();
    assertEquals(0, pw.getProblems(ProblemType.ERROR).size());
    assertEquals(0, pw.getProblems(ProblemType.WARNING).size());
}
Also used : HibernateJPAWizard(org.jboss.tools.hibernate.reddeer.jdt.ui.jpa.process.wizard.HibernateJPAWizard) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) ProblemsView(org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)

Example 4 with ProblemsView

use of org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView 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 5 with ProblemsView

use of org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView 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)

Aggregations

ProblemsView (org.eclipse.reddeer.eclipse.ui.views.markers.ProblemsView)5 Problem (org.eclipse.reddeer.eclipse.ui.problems.Problem)4 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)3 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)2 ProblemExists (org.eclipse.reddeer.eclipse.condition.ProblemExists)2 PackageExplorerPart (org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart)2 MarkerDescriptionMatcher (org.eclipse.reddeer.eclipse.ui.markers.matcher.MarkerDescriptionMatcher)2 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 CaptureScreenshotException (org.eclipse.reddeer.junit.screenshot.CaptureScreenshotException)1 TextEditor (org.eclipse.reddeer.workbench.impl.editor.TextEditor)1 HibernateJPAWizard (org.jboss.tools.hibernate.reddeer.jdt.ui.jpa.process.wizard.HibernateJPAWizard)1 JPAProjectWizard (org.jboss.tools.hibernate.reddeer.wizard.JPAProjectWizard)1 JPAProjectWizardFirstPage (org.jboss.tools.hibernate.reddeer.wizard.JPAProjectWizardFirstPage)1 JpaFacetInstallPage (org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage)1 HibernateTestException (org.jboss.tools.hibernate.ui.bot.test.HibernateTestException)1