org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences Java Examples

The following examples show how to use org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences. 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: MergeSegmentsTest.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 每个测试开始之前执行
 */
@Before
public void setUp() {
	if (SLOW_PLAYBACK) {
		SWTBotPreferences.PLAYBACK_DELAY = 500;
	}
	SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
	INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR;
	reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?";
	bot = HSBot.bot();
	bot.closeAllEditors();
	ts = TS.getInstance();
	prjName = "swtBot-Project-001";
	fileName = "HSCAT8-3.xlf";
	ProjectTreeView.doubleClickXlfFile(prjName, fileName);
	xe = new XlfEditor(bot.editorByTitle(fileName));
}
 
Example #2
Source File: ImportAndReadPcapTest.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 for swtbot */
    SWTBotPreferences.TIMEOUT = 300000; /* 300 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
    fBot = new SWTWorkbenchBot();

    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(NETWORK_PERSPECTIVE_ID);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #3
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 #4
Source File: MergeSegmentsTest.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 每个测试开始之前执行
 */
@Before
public void setUp() {
	if (SLOW_PLAYBACK) {
		SWTBotPreferences.PLAYBACK_DELAY = 500;
	}
	SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
	INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR;
	reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?";
	bot = HSBot.bot();
	bot.closeAllEditors();
	ts = TS.getInstance();
	prjName = "swtBot-Project-001";
	fileName = "HSCAT8-3.xlf";
	ProjectTreeView.doubleClickXlfFile(prjName, fileName);
	xe = new XlfEditor(bot.editorByTitle(fileName));
}
 
Example #5
Source File: CoreSwtbotTools.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Sets common SWTBot preferences.
 */
public static void initializePreferences() {
  // -Dorg.eclipse.swtbot.playback.delay=2
  SWTBotPreferences.PLAYBACK_DELAY = BOT_PLAYBACK_DELAY;

  // System.setProperty("org.eclipse.swtbot.keyboardLayout", "EN_US");
  SWTBotPreferences.KEYBOARD_LAYOUT = "org.eclipse.swtbot.swt.finder.keyboard.EN_US";

  // SWTBot Keyboard strategies
  SWTBotPreferences.KEYBOARD_STRATEGY = "org.eclipse.swtbot.swt.finder.keyboard.SWTKeyboardStrategy";

  // keyboard type interval
  SWTBotPreferences.TYPE_INTERVAL = KEYBOARD_TYPE_INTERVAL;

  // Waiting for Widgets
  SWTBotPreferences.TIMEOUT = BOT_WIDGET_TIMEOUT;

  // screenshot directory
  SWTBotPreferences.SCREENSHOTS_DIR = System.getProperty(SWTBotPreferenceConstants.KEY_SCREENSHOTS_DIR, "target/screenshots");

  // test window focus policy
  workbenchFocusPolicy = WorkbenchFocusPolicy.valueOf(System.getProperty(PROPERTY_COM_AVALOQ_TEST_WORKBENCHFOCUSPOLICY, WorkbenchFocusPolicy.REFOCUS.toString()));

  preferencesInitialized = true;
}
 
Example #6
Source File: TestInvalidCtfTrace.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initialization
 */
@BeforeClass
public static void beforeClass() {
    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();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    SWTBotUtils.createProject(PROJET_NAME);

}
 
Example #7
Source File: DeChKeyboardLayoutTest.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Tests com.avaloq.test.swtbot.DE_CH.
 */
@Test
public void testDeChKeyboardLayout() {
  SWTBotPreferences.KEYBOARD_LAYOUT = "com.avaloq.test.swtbot.DE_CH";
  SWTBotPreferences.KEYBOARD_STRATEGY = "org.eclipse.swtbot.swt.finder.keyboard.MockKeyboardStrategy";
  SwtWorkbenchBot bot = new SwtWorkbenchBot();

  bot.closeWelcomePage();
  bot.menu("File").menu("New").menu("Untitled Text File").click();
  SWTBotEclipseEditor editor = bot.activeEditor().toTextEditor();
  editor.setFocus();
  editor.typeText(EXPECTED_RESULT);
  String actualResult = editor.getText();
  bot.closeAllEditors();

  assertEquals("Written and read characters must exactly match", EXPECTED_RESULT, actualResult);
}
 
Example #8
Source File: XmlTimegraphViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Things to setup
 */
@Before
public void before() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 10000; /* 10 second timeout */
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    fBot = new SWTWorkbenchBot();

    loadXmlFile();
    openTrace();
    openView(VIEW_NAME);
}
 
Example #9
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 #10
Source File: ViewsResponseTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Things to setup
 */
@Before
public void beforeClass() {

    SWTBotUtils.initialize();
    Thread.currentThread().setName("SWTBotTest");
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 60000; /* 60 second timeout */
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    SWTBotUtils.closeView("welcome", bot);
    /* Prepare the workspace */
    prepareWorkspace();
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    /* Create project */
    SWTBotUtils.createProject(PROJECT_NAME);
}
 
Example #11
Source File: XYDataProviderBaseTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 */
@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();
    SWTBotUtils.closeView("welcome", fBot);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #12
Source File: TraceTypePreferencePageTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 */
@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();
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

    /* set up test trace */
    setUpTrace();

}
 
Example #13
Source File: FontEventEditorTest.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 #14
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 #15
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 #16
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 #17
Source File: FilterViewerTest.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 {
    IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
    defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "GMT-05:00");
    TmfTimestampFormat.updateDefaultFormats();

    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();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fFileLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fFileLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < 100; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
}
 
Example #18
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 #19
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 #20
Source File: SystemCallLatencyDensityViewTest.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));
    fBot = new SWTWorkbenchBot();
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();

}
 
Example #21
Source File: LamiChartViewerTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Start the SWT bot test, register the LAMI analyses and open a trace (any
 * trace) on a new project
 */
@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();

    OnDemandAnalysisManager.getInstance().registerAnalysis(LamiAnalyses.MULTIPLE_ROW.getAnalysis());
    OnDemandAnalysisManager.getInstance().registerAnalysis(LamiAnalyses.MULTIPLE_SIMILAR_ROW.getAnalysis());

    // Create the project and open the trace
    String tracePath = TRACE.getFullPath();

    SWTBotUtils.createProject(PROJECT_NAME);
    SWTBotUtils.openTrace(PROJECT_NAME, tracePath, TRACE_TYPE);
    WaitUtils.waitForJobs();
}
 
Example #22
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 #23
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 *
 * @throws IOException
 *             When the trace could not be opened
 */
@BeforeClass
public static void beforeClass() throws IOException {
    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();
    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Open the trace */
    String tracePath = FileUtils.toFile(FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL())).getAbsolutePath();
    SWTBotUtils.openTrace(TRACE_PROJECT_NAME, tracePath, KERNEL_TRACE_TYPE);
    /* Finish waiting for eclipse to load */
    SWTBotUtils.activateEditor(fBot, CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL().getPath().replaceAll("/", ""));
}
 
Example #24
Source File: OpenTraceStressTest.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 for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */

    workbenchbot = new SWTWorkbenchBot();

    /* Close welcome view */
    SWTBotUtils.closeView("Welcome", workbenchbot);

    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID);

    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #25
Source File: KernelTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 */
@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();
    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #26
Source File: TimeGraphViewUiContextTestBase.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Before Class
 *
 * @throws IOException
 *             If the traces can not be found
 */
@BeforeClass
public static void beforeClass() throws IOException {
    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();
    SWTBotUtils.closeView("welcome", fBot);
    /* Switch perspectives */
    SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID);
    /* Create the trace project */
    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
    /* Finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
}
 
Example #27
Source File: ControlViewTest.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 */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

    SWTBotUtils.closeView("welcome", fBot);

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

    SWTBotUtils.switchToPerspective(PERSPECTIVE_ID);
}
 
Example #28
Source File: TestImportExportPackageWizard.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/** Test Class setup */
@BeforeClass
public static void init() {
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    SWTBotUtils.initialize();
    Thread.currentThread().setName(SWT_BOT_THREAD_NAME); // for the debugger
    /* set up for swtbot */
    SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
    fLogger.removeAllAppenders();
    fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
    fBot = new SWTWorkbenchBot();

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

}
 
Example #29
Source File: ColorsViewTest.java    From tracecompass with Eclipse Public License 2.0 5 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()));
    fBot = new SWTWorkbenchBot();

    /* finish waiting for eclipse to load */
    WaitUtils.waitForJobs();
    fFileLocation = File.createTempFile("sample", ".xml");
    try (BufferedRandomAccessFile braf = new BufferedRandomAccessFile(fFileLocation, "rw")) {
        braf.writeBytes(TRACE_START);
        for (int i = 0; i < 100; i++) {
            braf.writeBytes(makeEvent(i * 100, i % 4));
        }
        braf.writeBytes(TRACE_END);
    }
    /* Creating project and open the trace */
    SWTBotUtils.createProject(PROJECT_NAME);
    SWTBotTreeItem treeItem = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
    assertNotNull(treeItem);
    SWTBotUtils.openTrace(PROJECT_NAME, fFileLocation.getAbsolutePath(), XMLSTUB_ID);
    SWTBotUtils.openView(ColorsView.ID);

}
 
Example #30
Source File: TmfPerspectiveManagerTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test Class setup
 *
 * @throws IOException if an exception occurs
 */
@BeforeClass
public static void beforeClass() throws IOException {
    SWTBotUtils.initialize();

    fTmpFolder = File.createTempFile("testTraces", "");
    if (!fTmpFolder.isDirectory()) {
        fTmpFolder.delete();
        fTmpFolder.mkdir();
    }
    LttngTraceGenerator kernelGenerator = new LttngTraceGenerator(1000, 1000, 1);
    LttngTraceGenerator ustGenerator = new LttngTraceGenerator(1000, 1000, 1, false);
    fKernelPath = fTmpFolder.getAbsolutePath() + File.separator + "kernel";
    fUstPath = fTmpFolder.getAbsolutePath() + File.separator + "ust";
    kernelGenerator.writeTrace(new File(fKernelPath));
    ustGenerator.writeTrace(new File(fUstPath));

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

    /* Close welcome view */
    SWTBotUtils.closeView("Welcome", fBot);

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

    SWTBotUtils.createProject(TRACE_PROJECT_NAME);
}