Search in sources :

Example 41 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile 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();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) NextButton(org.eclipse.reddeer.swt.impl.button.NextButton) TreeItem(org.eclipse.reddeer.swt.api.TreeItem) DefaultHyperlink(org.eclipse.reddeer.uiforms.impl.hyperlink.DefaultHyperlink) OkButton(org.eclipse.reddeer.swt.impl.button.OkButton) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) Shell(org.eclipse.reddeer.swt.api.Shell) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) PropertyDialog(org.eclipse.reddeer.eclipse.ui.dialogs.PropertyDialog) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) FacetsPropertyPage(org.eclipse.reddeer.eclipse.wst.common.project.facet.ui.FacetsPropertyPage) JpaFacetInstallPage(org.jboss.tools.hibernate.reddeer.wizard.JpaFacetInstallPage)

Example 42 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile 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 43 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile in project jbosstools-openshift by jbosstools.

the class DeleteResourceTest method testDeletePod.

@Test
public void testDeletePod() {
    OpenShiftResource applicationPod = OpenShiftUtils.getOpenShiftPod(projectReq.getProjectName(), new StringStartsWith("eap-app-"), connectionReq.getConnection());
    String podName = applicationPod.getName();
    applicationPod.delete();
    try {
        OpenShiftResourceExists openShiftResourceExists = new OpenShiftResourceExists(Resource.POD, podName, ResourceState.UNSPECIFIED, projectReq.getProjectName(), connectionReq.getConnection());
        new WaitWhile(openShiftResourceExists, TimePeriod.getCustom(15));
    } catch (WaitTimeoutExpiredException ex) {
        fail("Application pod should be deleted at this point, but it it still present.");
    }
}
Also used : StringStartsWith(org.hamcrest.core.StringStartsWith) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) WaitTimeoutExpiredException(org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException) OpenShiftResourceExists(org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists) OpenShiftResource(org.jboss.tools.openshift.reddeer.view.resources.OpenShiftResource) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 44 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile 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 45 with WaitWhile

use of org.eclipse.reddeer.common.wait.WaitWhile 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

WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)209 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)142 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)97 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)84 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)72 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)49 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)45 Test (org.junit.Test)42 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)36 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)36 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)31 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)30 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)24 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)22 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)19 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)19 Shell (org.eclipse.reddeer.swt.api.Shell)17 DefaultTable (org.eclipse.reddeer.swt.impl.table.DefaultTable)17 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)16 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)16