Search in sources :

Example 31 with JobIsRunning

use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationTest method prepareConsoleConfiguration.

public void prepareConsoleConfiguration(String hibernateVersion) {
    KnownConfigurationsView v = new KnownConfigurationsView();
    v.open();
    EditConfigurationShell s = v.addConfiguration();
    s.setName(CONSOLE_NAME);
    EditConfigurationMainPage p = s.getMainPage();
    p.setProject(prjName);
    p.setDatabaseConnection(PredefinedConnection.HIBERNATE_CONFIGURED_CONNECTION);
    p.setConfigurationFile("/" + prjName + "/" + HIBERNATE_CFG_FILE);
    p.setHibernateVersion(hibernateVersion);
    // ANY ERROR IN WIZARD ??
    s.ok();
    v.open();
    EditConfigurationShell s2 = v.openConsoleConfiguration(CONSOLE_NAME);
    s2.close();
    v.open();
    try {
        v.selectNode(CONSOLE_NAME, "Database", "SAKILA.PUBLIC", "ACTOR");
    } catch (WaitTimeoutExpiredException e) {
        log.info("Wait timeout occured, try rebuilding console config");
        v.selectConsole(CONSOLE_NAME);
        new ContextMenuItem("Rebuild configuration").select();
        new WaitWhile(new JobIsRunning());
        v.selectNode(CONSOLE_NAME, "Database", "SAKILA.PUBLIC", "ACTOR");
    }
}
Also used : WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) EditConfigurationShell(org.jboss.tools.hibernate.reddeer.console.EditConfigurationShell) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) EditConfigurationMainPage(org.jboss.tools.hibernate.reddeer.console.EditConfigurationMainPage) KnownConfigurationsView(org.jboss.tools.hibernate.reddeer.console.views.KnownConfigurationsView) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Example 32 with JobIsRunning

use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning in project jbosstools-hibernate by jbosstools.

the class MappingDiagramTest method checkMappingDiagram.

private void checkMappingDiagram() {
    AutoBuilding ab = new AutoBuilding() {

        @Override
        public Class<? extends Annotation> annotationType() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public boolean value() {
            return false;
        }

        @Override
        public boolean cleanup() {
            // TODO Auto-generated method stub
            return true;
        }
    };
    AutoBuildingRequirement abr = new AutoBuildingRequirement();
    abr.setDeclaration(ab);
    openMappingDiagram();
    try {
        new DefaultEditor(prj + ": Actor and 15 others");
    } catch (RedDeerException e) {
        // workaroud due to buggy auto building
        abr.fulfill();
        PackageExplorerPart pe = new PackageExplorerPart();
        pe.getProject(prj).select();
        new ShellMenuItem("Project", "Build Project").select();
        new WaitWhile(new JobIsRunning());
        openMappingDiagram();
        new DefaultEditor(prj + ": Actor and 15 others");
    } finally {
        abr.cleanUp();
    }
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) ShellMenuItem(org.eclipse.reddeer.swt.impl.menu.ShellMenuItem) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) AutoBuildingRequirement(org.eclipse.reddeer.requirements.autobuilding.AutoBuildingRequirement) AutoBuilding(org.eclipse.reddeer.requirements.autobuilding.AutoBuildingRequirement.AutoBuilding) PackageExplorerPart(org.eclipse.reddeer.eclipse.jdt.ui.packageview.PackageExplorerPart) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) DefaultEditor(org.eclipse.reddeer.workbench.impl.editor.DefaultEditor)

Example 33 with JobIsRunning

use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning 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 34 with JobIsRunning

use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning in project jbosstools-openshift by jbosstools.

the class PublishChangesTest method verifyChangesTookEffect.

private void verifyChangesTookEffect() {
    new ServerAdapter(Version.OPENSHIFT3, "eap-app", "Service").select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.SHOW_IN_WEB_BROWSER).select();
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
    try {
        new WaitUntil(new BrowserContainsText("Hello"), TimePeriod.VERY_LONG);
    } catch (WaitTimeoutExpiredException ex) {
        fail("Application was not deployed successfully because it is not shown in web browser properly.");
    }
}
Also used : ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) BrowserContainsText(org.jboss.tools.openshift.reddeer.condition.BrowserContainsText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 35 with JobIsRunning

use of org.eclipse.reddeer.workbench.core.condition.JobIsRunning in project jbosstools-openshift by jbosstools.

the class PublishChangesTest method removeAdapterAndApplication.

@AfterClass
public static void removeAdapterAndApplication() {
    try {
        new WaitWhile(new JobIsRunning(), TimePeriod.LONG);
        new ServerAdapter(Version.OPENSHIFT3, "eap-app", "Service").delete();
    } catch (OpenShiftToolsException ex) {
    // do nothing, adapter does not exists
    }
    new ProjectExplorer().getProject(PROJECT_NAME).delete(false);
    TestUtils.cleanupGitFolder(new File(GIT_REPO_DIRECTORY));
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) File(java.io.File) OpenShiftToolsException(org.jboss.tools.openshift.reddeer.exception.OpenShiftToolsException) AfterClass(org.junit.AfterClass)

Aggregations

JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)154 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)142 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)62 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)52 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)46 Test (org.junit.Test)36 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)31 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)29 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)28 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)23 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)19 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)18 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)18 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)17 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)16 ImageRunSelectionPage (org.eclipse.linuxtools.docker.reddeer.core.ui.wizards.ImageRunSelectionPage)14 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)14 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)13 AbstractImageBotTest (org.eclipse.linuxtools.docker.integration.tests.image.AbstractImageBotTest)12 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)10