Java Code Examples for org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences#TIMEOUT

The following examples show how to use org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences#TIMEOUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectExplorerTracesFolderTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 *
 * @throws IOException
 */
@BeforeClass
public static void init() throws IOException {
    TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH);

    SWTBotUtils.initialize();

    /* Set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    importCustomParsers();
}
 
Example 2
Source File: TestTraceOffsetting.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization, creates a temp trace
 *
 * @throws IOException
 *             should not happen
 */
@Before
public void init() throws IOException {
    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "GMT-05:00");
    TmfTimestampFormat.updateDefaultFormats();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < NUM_EVENTS; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
}
 
Example 3
Source File: ProjectExplorerRefreshTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 *
 * @throws Exception
 *             on error
 */
@BeforeClass
public static void init() throws Exception {
    TestDirectoryStructureUtil.generateTraceStructure(TEST_TRACES_PATH);

    SWTBotUtils.initialize();

    /* Set up for SWTBot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(TRACE_PROJECT_NAME);
    fTracesFolder = new File(Objects.requireNonNull(TmfProjectRegistry.getProject(project, true).getTracesFolder()).getResource().getLocation().toOSString());

    createCProject(C_PROJECT_NAME);
    setTracingNature(C_PROJECT_NAME);
    IProject cProject = ResourcesPlugin.getWorkspace().getRoot().getProject(C_PROJECT_NAME);
    fCProjectFolder = cProject.getLocation().toFile();
}
 
Example 4
Source File: TmfAlignTimeAxisTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization, creates a temp trace
 *
 * @throws IOException
 *             should not happen
 */
@BeforeClass
public static void init() throws IOException {
    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    SWTWorkbenchBot bot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < NUM_EVENTS; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
    SWTBotUtils.createProject(PROJET_NAME);
    SWTBotUtils.selectTracesFolder(bot, PROJET_NAME);
}
 
Example 5
Source File: MarkerSetSwtBotTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Set up the test context and environment
 */
@BeforeClass
public static void setUp() {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 10000; /* 10 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fBot = new SWTWorkbenchBot();

    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    WaitUtils.waitForJobs();

    final CtfTestTrace cygProfile = CtfTestTrace.CYG_PROFILE;
    LttngUstTrace trace = LttngUstTestTraceUtils.getTrace(cygProfile);
    fStart = ((CtfTmfTrace) trace).getStartTime().toNanos();
    fFullRange = new TmfTimeRange(TmfTimestamp.fromNanos(fStart), TmfTimestamp.fromNanos(fStart + 100l));
    final File file = new File(trace.getPath());
    LttngUstTestTraceUtils.dispose(cygProfile);
    SWTBotUtils.openTrace(TRACE_PROJECT_NAME, file.getAbsolutePath(), UST_ID);
    SWTBotUtils.openView(FlameChartView.ID);
    fViewBot = fBot.viewByTitle("Flame Chart");
    WaitUtils.waitForJobs();
}
 
Example 6
Source File: PatternLatencyViewTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Things to setup
 */
@BeforeClass
public static void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    fBot = new SWTWorkbenchBot();

    loadXmlFile();
    openTrace();
}
 
Example 7
Source File: MovableColumnEventsEditorTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test Class setup
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();

    /* set up test trace */
    URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(COLUMN_TRACE_PATH), null);
    URI uri;
    try {
        uri = FileLocator.toFileURL(location).toURI();
        fTestFile = new File(uri);
    } catch (URISyntaxException | IOException e) {
        fail(e.getMessage());
    }

    assumeTrue(fTestFile.exists());

    /* Set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example 8
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();

    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    sfLogger.removeAllAppenders();
    sfLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    sfBot = new SWTWorkbenchBot();

    SWTBotUtils.closeView("Statistics", sfBot);
    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example 9
Source File: ChartMakerDialogTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Things to setup
 */
@BeforeClass
public static void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    SWTBotUtils.openView(CustomChartStubView.ID);
    CustomChartStubView.setChartProvider(CHART_PROVIDER);
}
 
Example 10
Source File: BookmarksViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialization
 */
@BeforeClass
public static void init() {
    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBot Thread"); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    SWTBotUtils.switchToTracingPerspective();
    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example 11
Source File: TestRefreshTextTrace.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/** Test Class setup */
@BeforeClass
public static void init() {
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    SWTBotUtils.initialize();
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new NullAppender());
    fBot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example 12
Source File: XMLAnalysesManagerPreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Before Class for launch and setup
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();
}
 
Example 13
Source File: XYChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Set up for test
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
}
 
Example 14
Source File: CtfTmfExperimentTrimmingTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Setup before the test suite
 *
 * @throws IOException
 *             failed to load the file
 */
@BeforeClass
public static void beforeClass() throws IOException {
    SWTBotUtils.initialize();

    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 50000; /* 50 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new NullAppender());

    File parentDir = FileUtils.toFile(FileLocator.toFileURL(CtfTestTrace.TRACE_EXPERIMENT.getTraceURL()));
    File[] traceFiles = parentDir.listFiles();
    ITmfTrace traceValidator = new CtfTmfTrace();
    fBot = new SWTWorkbenchBot();
    SWTBotUtils.createProject(PROJECT_NAME);

    int openedTraces = 0;
    for (File traceFile : traceFiles) {
        String absolutePath = traceFile.getAbsolutePath();
        if (traceValidator.validate(null, absolutePath).isOK()) {
            SWTBotUtils.openTrace(PROJECT_NAME, absolutePath, TRACE_TYPE);
            fBot.closeAllEditors();
            openedTraces++;
            if (openedTraces >= NUM_TRACES) {
                break;
            }
        }
    }
    traceValidator.dispose();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example 15
Source File: TimeGraphViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Set up for test
 */
@BeforeClass
public static void beforeClass() {
    SWTBotUtils.initialize();
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fHair = ImageHelper.adjustExpectedColor(new RGB(0, 64, 128));
    fHat = ImageHelper.adjustExpectedColor(new RGB(0, 255, 0));
    fLaser = ImageHelper.adjustExpectedColor(new RGB(255, 0, 0));
}
 
Example 16
Source File: ContextActionUiTestUtil.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Clicks the context menu matching the given labels.
 * When a context menu 'Compile' exists with the sub context menu 'All Invalids',
 * then the context menu 'All Invalids' can be clicked by giving the labels 'Compile' and 'All Invalids'.
 *
 * @param bot
 *          the {@link AbstractSWTBot} on which to infer the context menu
 * @param labels
 *          the labels on the context menus
 * @throw {@link WidgetNotFoundException} if the context menu could not be found
 */
public static void clickContextMenu(final AbstractSWTBot<? extends Control> bot, final String... labels) {
  MenuItem menuItem = getContextMenuItem(bot, labels);
  if (menuItem == null) {
    long endTime = System.currentTimeMillis() + SWTBotPreferences.TIMEOUT;
    while (menuItem == null && System.currentTimeMillis() < endTime) {
      SWTUtils.sleep(SWTBotPreferences.DEFAULT_POLL_DELAY);
      menuItem = getContextMenuItem(bot, labels);
    }
    if (menuItem == null) {
      throw new WidgetNotFoundException("Could not find menu: " + Arrays.asList(labels));
    }
  }
  click(menuItem);
}
 
Example 17
Source File: DeployWizardIT.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void should_deploy_a_project_using_wizard() throws Exception {
    BotApplicationWorkbenchWindow botApplicationWorkbenchWindow = new BotApplicationWorkbenchWindow(bot);

    BotDeployDialog botDeployDialog = botApplicationWorkbenchWindow.importBOSArchive()
            .setArchive(DeployWizardIT.class.getResource("/DeployAll-1.0.bos"))
            .importAndDeploy();

    assertThat(botDeployDialog.isCleanBDMDatabaseEnabled()).isTrue();
    assertThat(botDeployDialog.isCleanBDMDatabaseSelected()).isFalse();
    assertThat(botDeployDialog.isValidateSelected()).isTrue();
    assertThat(botDeployDialog.isDefaultUserEnabled()).isTrue();

    botDeployDialog.runValidation(false);

    //Check select none/all/latest
    botDeployDialog.selectNone();
    assertThat(botDeployDialog.isDeployEnabled()).isFalse();
    botDeployDialog.selectAll();
    assertThat(botDeployDialog.isDeployEnabled()).isTrue();
    botDeployDialog.selectLatest();
    assertThat(botDeployDialog.artifactsTree().getSWTBotWidget().getTreeItem("Processes").getNode("Pool")
            .getNode("1.0  MonDiagramme-1.0.proc").isChecked()).isFalse();
    assertThat(botDeployDialog.artifactsTree().getSWTBotWidget().getTreeItem("Processes").getNode("Pool")
            .getNode("2.0  MonDiagramme-2.0.proc").isChecked()).isTrue();

    //Check username validation
    botDeployDialog.setDefaultUser("john.doe");
    assertThat(botDeployDialog.isDeployEnabled()).isFalse();
    botDeployDialog.setDefaultUser("helen.kelly");
    assertThat(botDeployDialog.isDeployEnabled()).isTrue();

    botDeployDialog.artifactsTree().getSWTBotWidget().getTreeItem("Organization").getItems()[0].uncheck();
    assertThat(botDeployDialog.isDefaultUserEnabled()).isTrue();

    long timeout = SWTBotPreferences.TIMEOUT;
    try {
        SWTBotPreferences.TIMEOUT = 500;
        bot.ccomboBoxWithLabelInGroup(Messages.environment, Messages.deployOptions);
        fail("Environment combo should not be visible in community edition");
    } catch (WidgetNotFoundException e) {
        // Environment combo should not be there in community
    } finally {
        SWTBotPreferences.TIMEOUT = timeout;
    }

    botDeployDialog.deploy();
    assertThat(bot.button(IDialogConstants.OPEN_LABEL).isEnabled()).isTrue();
    assertThat(bot.comboBox().getText()).contains("My App as User");
    bot.button(IDialogConstants.CLOSE_LABEL).click();

    checkDeployedContent();

    //Check last selected elements are saved
    botDeployDialog = botApplicationWorkbenchWindow.openDeploy();
    assertThat(botDeployDialog.isValidateSelected()).isFalse();
    assertThat(
            botDeployDialog.artifactsTree().getSWTBotWidget().getTreeItem("Organization").getItems()[0].isChecked())
                    .isFalse();
    assertThat(botDeployDialog.artifactsTree().getSWTBotWidget().getTreeItem("Processes").getNode("Pool")
            .getNode("1.0  MonDiagramme-1.0.proc").isChecked()).isFalse();
    assertThat(botDeployDialog.artifactsTree().getSWTBotWidget().getTreeItem("Processes").getNode("Pool")
            .getNode("2.0  MonDiagramme-2.0.proc").isChecked()).isTrue();

    botDeployDialog.cancel();
}
 
Example 18
Source File: SwtBotTimeoutManager.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
private static void setSwtBotPrefsTimeoutFieldValue(long timeout) {
  if (timeout == UNSET_TIMEOUT_VALUE) {
    return;
  }
  SWTBotPreferences.TIMEOUT = timeout;
}
 
Example 19
Source File: AddProjectNatureTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test Class setup
 *
 * @throws Exception
 *             on error
 */
@BeforeClass
public static void init() throws Exception {
    IProgressMonitor progressMonitor = new NullProgressMonitor();
    IWorkspace workspace = ResourcesPlugin.getWorkspace();

    SWTBotUtils.initialize();

    /* Set up for SWTBot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    // Manually create C project
    fWorkspaceRoot = workspace.getRoot();
    fSomeProject = fWorkspaceRoot.getProject(SOME_PROJECT_NAME);
    fSomeProject.create(progressMonitor);
    fSomeProject.open(progressMonitor);
    IProjectDescription description = fSomeProject.getDescription();
    description.setNatureIds(new String[] { "org.eclipse.cdt.core.cnature" });
    fSomeProject.setDescription(description, null);
    fSomeProject.open(progressMonitor);

    /* set up test trace */
    URL location = FileLocator.find(TmfCoreTestPlugin.getDefault().getBundle(), new Path(TRACE_PATH), null);
    URI uri;
    try {
        uri = FileLocator.toFileURL(location).toURI();
        fTestFile = new File(uri);
    } catch (URISyntaxException | IOException e) {
        fail(e.getMessage());
    }
    assumeTrue(fTestFile.exists());

    /* setup timestamp preference */
    IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    defaultPreferences.put(ITmfTimePreferencesConstants.DATIME, "MMM d HH:mm:ss");
    defaultPreferences.put(ITmfTimePreferencesConstants.SUBSEC, ITmfTimePreferencesConstants.SUBSEC_NO_FMT);
    TmfTimestampFormat.updateDefaultFormats();
}
 
Example 20
Source File: SwtBotTimeoutManager.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
private static long getSwtBotPrefsTimeoutFieldValue() {
  return SWTBotPreferences.TIMEOUT;
}