// "Operations and Monitoring Explorer"
  public static SWTBotTree getTree(String ViewTitle) throws Exception {
    SWTBotView view = bot.viewByTitle(ViewTitle);
    view.show();

    Tree tree = (Tree) bot.widget(widgetOfType(Tree.class), view.getWidget());
    return new SWTBotTree(tree);
  }
Пример #2
0
  @Test
  public void shouldUpdateTrackingBranchOnPush() throws Exception {
    makeChangesAndCommit(PROJ1);
    Repository repository = lookupRepository(repositoryFile);
    ObjectId headId = repository.resolve(Constants.HEAD);

    String trackingBranch = Constants.R_REMOTES + "origin/master";
    launchSynchronization(Constants.HEAD, trackingBranch, false);

    SWTBotView viewBot = bot.viewByTitle("Synchronize");
    SWTBotToolbarButton pushButton = viewBot.toolbarButton(UIText.GitActionContributor_Push);
    JobJoiner jobJoiner = JobJoiner.startListening(JobFamilies.PUSH, 30, TimeUnit.SECONDS);
    pushButton.click();
    jobJoiner.join();

    String destinationString = repositoryFile.getParentFile().getName() + " - " + "origin";
    SWTBotShell resultDialog =
        bot.shell(NLS.bind(UIText.PushResultDialog_title, destinationString));
    resultDialog.close();

    Repository remoteRepository = lookupRepository(childRepositoryFile);
    ObjectId masterOnRemote = remoteRepository.resolve("master");
    assertThat("Expected push to update branch on remote repository", masterOnRemote, is(headId));

    ObjectId trackingId = repository.resolve(trackingBranch);
    assertThat("Expected tracking branch to be updated", trackingId, is(headId));
  }
  @After
  public void canDeleteEWSApp() {
    SWTBotView openshiftExplorer = open.viewOpen(OpenShiftUI.Explorer.iView);

    SWTBotTreeItem account =
        openshiftExplorer.bot().tree().getAllItems()[0].doubleClick(); // expand account

    bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S * 2, TIME_1S);

    account
        .getNode(EWS_APP_NAME + " " + OpenShiftUI.AppType.JBOSS_EWS)
        .contextMenu(OpenShiftUI.Labels.EXPLORER_DELETE_APP)
        .click();

    bot.waitForShell(OpenShiftUI.Shell.DELETE_APP);

    bot.button(IDELabel.Button.OK).click();
    bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S * 2, TIME_1S);

    assertTrue(
        "Application still present in the OpenShift Explorer!", account.getItems().length == 0);

    projectExplorer.show();
    projectExplorer.deleteAllProjects();

    assertFalse("The project still exists!", bot.tree().getAllItems().length > 0);

    servers.show();
    servers.deleteServer(EWS_APP_NAME + " at OpenShift");
  }
Пример #4
0
 /** Test tool bar buttons "Select Next Event" and "Select Previous Event" */
 @Test
 public void testToolBarSelectNextPreviousEvent() {
   testNextPreviousEvent(
       () -> fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(),
       () -> fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT),
       () -> fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(),
       () -> fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT));
 }
Пример #5
0
 /** Before Test */
 @Override
 @Before
 public void before() {
   super.before();
   fViewBot = fBot.viewByTitle("Control Flow");
   fViewBot.show();
   fViewBot.setFocus();
 }
Пример #6
0
 /**
  * Show properties
  *
  * @throws Exception
  */
 @Test
 public void testShowProperties() throws Exception {
   SWTBotTree tree = getOrOpenView().bot().tree();
   SWTBotTreeItem item = myRepoViewUtil.getRootItem(tree, repositoryFile);
   item.select();
   ContextMenuHelper.clickContextMenuSync(
       tree, myUtil.getPluginLocalizedValue("ShowIn"), "Properties");
   SWTBotView propertieView = bot.viewById(IPageLayout.ID_PROP_SHEET);
   assertTrue(propertieView.isActive());
 }
Пример #7
0
 protected static boolean isProjectCreated(final String name) {
   try {
     final SWTBotView packageExplorer = getNavigator();
     final SWTBotTree tree = packageExplorer.bot().tree();
     tree.getTreeItem(name);
     return true;
   } catch (final WidgetNotFoundException e) {
     return false;
   }
 }
  /** Import a gzip trace */
  @Test
  public void testGzipImport() {
    final String traceType = "Test trace : TMF Tests";
    final String tracesNode = "Traces [1]";

    /*
     * Actual importing
     */
    openImportWizard();
    selectImportFromArchive(fGzipTrace.getAbsolutePath());
    selectFolder(ROOT_FOLDER);
    SWTBotCheckBox checkBox = fBot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
    assertFalse(checkBox.isEnabled());
    SWTBotCombo comboBox = fBot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType);
    comboBox.setSelection(traceType);
    importFinish();
    /*
     * Remove .gz extension
     */
    assertNotNull(fGzipTrace);
    String name = fGzipTrace.getName();
    assertNotNull(name);
    assertTrue(name.length() > 3);
    String traceName = name.substring(0, name.length() - 3);
    assertNotNull(traceName);
    assertFalse(traceName.isEmpty());

    /*
     * Open trace
     */
    SWTBotView projectExplorer = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
    projectExplorer.setFocus();
    final SWTBotTree tree = projectExplorer.bot().tree();
    /*
     * This appears to be problematic due to the length of the file name and
     * the resolution in our CI.
     */
    tree.expandNode(PROJECT_NAME, true);
    SWTBotTreeItem treeItem = tree.getTreeItem(PROJECT_NAME);
    fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(tracesNode, treeItem));
    treeItem = treeItem.getNode(tracesNode);
    fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(traceName, treeItem));
    treeItem = treeItem.getNode(traceName);
    treeItem.doubleClick();
    SWTBotUtils.waitForJobs();
    /*
     * Check results
     */
    SWTBotTable editor = fBot.activeEditor().bot().table();
    String c22 = editor.cell(2, 2);
    String c10 = editor.cell(1, 0);
    assertEquals("Type-1", c22);
    assertEquals("", c10);
  }
  @Test
  public void canCreateEWSApp() {
    // open OpenShift Explorer
    SWTBotView openshiftExplorer = open.viewOpen(OpenShiftUI.Explorer.iView);

    openshiftExplorer
        .bot()
        .tree()
        .getAllItems()[0] // get 1st account in
        // OpenShift Explorer
        .contextMenu(OpenShiftUI.Labels.EXPLORER_NEW_APP)
        .click();

    bot.waitForShell(OpenShiftUI.Shell.NEW_APP);
    bot.waitWhile(new NonSystemJobRunsCondition(), TIME_20S, TIME_1S);

    // fill app info
    bot.textInGroup("New application", 0).typeText(EWS_APP_NAME);

    log.info("*** OpenShift SWTBot Tests: Application name set. ***");

    bot.comboBoxInGroup("New application").setSelection(OpenShiftUI.AppType.JBOSS_EWS);

    log.info("*** OpenShift SWTBot Tests: Application type selected. ***");

    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDELabel.Button.FINISH)));
    bot.button(IDELabel.Button.FINISH).click();

    log.info("*** OpenShift SWTBot Tests: Application creation started. ***");

    // only for the 1st time - with known_hosts deleting it will appear
    // every time
    // add to known_hosts
    bot.waitForShell("Question", TIME_60S * 4);
    bot.button(IDELabel.Button.YES).click();

    // create known_hosts since it does not exists any more
    SWTBotShell khShell = bot.waitForShell("Question");
    if (khShell != null) {
      bot.button(IDELabel.Button.YES).click();
    }

    bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S * 10, TIME_1S);

    servers.show();
    assertTrue(servers.serverExists(EWS_APP_NAME + " at OpenShift"));

    log.info("*** OpenShift SWTBot Tests: OpenShift Server Adapter created. ***");
  }
 /**
  * Debug Drools Rule and checks result
  *
  * @param droolsRuletName
  */
 private void debugDroolsRule(String droolsRuleName) {
   packageExplorer.show();
   SWTBotTreeItem tiDroolsRule =
       packageExplorer.selectTreeItem(
           DroolsAllBotTests.SAMPLE_DROOLS_RULE_NAME,
           new String[] {
             DroolsAllBotTests.DROOLS_PROJECT_NAME, DroolsAllBotTests.SRC_MAIN_RULES_TREE_NODE
           });
   SWTBot packageExplorerBot = bot.viewByTitle(ViewType.PACKAGE_EXPLORER.getViewLabel()).bot();
   SWTBotTree tree = packageExplorerBot.tree();
   // Select and Open Rule File
   ContextMenuHelper.prepareTreeItemForContextMenu(tree, tiDroolsRule);
   new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.OPEN, true)).click();
   SWTBotEclipseEditor ruleEditor = bot.editorByTitle(droolsRuleName).toTextEditor();
   ruleEditor.selectRange(8, 0, 0);
   bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.TOGGLE_BREAKPOINT).click();
   SWTBotTreeItem tiDroolsTest =
       packageExplorer.selectTreeItem(
           DroolsAllBotTests.DROOLS_TEST_JAVA_TREE_NODE,
           new String[] {
             DroolsAllBotTests.DROOLS_PROJECT_NAME,
             DroolsAllBotTests.SRC_MAIN_JAVA_TREE_NODE,
             DroolsAllBotTests.COM_SAMPLE_TREE_NODE
           });
   console.clearConsole();
   eclipse.debugTreeItemAsDroolsApplication(tiDroolsTest);
   eclipse.closeConfirmPerspectiveSwitchShellIfOpened(false);
   String consoleText = console.getConsoleText(3 * 1000L, 3 * 1000L, true);
   assertTrue(
       "Drools Rule was not debuged properly.\nConsole content should have been empty but is:\n"
           + consoleText,
       consoleText.length() == 0);
   SWTBotView debugView = bot.viewByTitle(ViewType.DEBUG.getViewLabel());
   debugView.toolbarButton(IDELabel.DebugView.BUTTON_STEP_OVER_TOOLTIP).click();
   consoleText = console.getConsoleText(3 * 1000L, 60 * 1000L, true);
   assertTrue(
       "Drools Rule was not debuged properly.\nConsole content should be:\n'Hello World\n' but is:\n"
           + consoleText,
       consoleText.equals("Hello World\n"));
   debugView.toolbarButton(IDELabel.DebugView.BUTTON_RESUME_TOOLTIP).click();
   consoleText = console.getConsoleText(3 * 1000L, 60 * 1000L, true);
   assertTrue(
       "Drools Rule was not debuged properly.\nConsole content should be:Hello World\nGoodbye cruel world\n"
           + consoleText,
       consoleText.equals("Hello World\nGoodbye cruel world\n"));
 }
Пример #11
0
  /**
   * Create a new Form and save it
   *
   * @param bot
   * @param gmfEditor
   * @param nameOfStepOnwhichCreateTheForm
   * @return
   */
  public static SWTBotEditor createFormWhenOnAProcessWithStep1(
      final SWTGefBot bot,
      final SWTBotGefEditor gmfEditor,
      final String nameOfStepOnwhichCreateTheForm) {
    final SWTBotGefEditPart part = gmfEditor.getEditPart(nameOfStepOnwhichCreateTheForm);
    if (part != null) {
      System.out.println("wow part is not null" + part.toString());
    } else {
      System.out.println("part is null");
    }

    try {
      System.out.println(
          "tosting is:"
              + part.toString()
              + "source size is:"
              + part.sourceConnections().size()
              + "target size is:"
              + part.targetConnections().size()
              + "parent"
              + part.parent().toString());
    } catch (final Exception e) {
      System.out.println("Exception is:" + e.getMessage());
    }

    part.click();

    // part.focus();

    bot.viewById("org.bonitasoft.studio.views.properties.application").show();
    bot.viewById("org.bonitasoft.studio.views.properties.application").setFocus();

    SWTBotTestUtil.selectTabbedPropertyView(bot, "Pageflow");
    final SWTBotView properties = bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_APPLICATION);
    properties.bot().button("Add...").click();
    bot.waitUntil(Conditions.shellIsActive("Add form..."));
    bot.button(IDialogConstants.NEXT_LABEL).click();

    bot.button("Unselect all").click();

    bot.button(IDialogConstants.FINISH_LABEL).click();
    final SWTBotEditor activeEditor = bot.activeEditor();
    activeEditor.save();
    return activeEditor;
  }
Пример #12
0
  @Test
  // Verify we can build and run the info MakeTarget tool
  public void t1canBuildAndAccessInfoTarget() throws Exception {
    clickProjectContextMenu("Build Project");

    // Wait until the project is built
    SWTBotShell shell = bot.shell("Build Project");
    bot.waitUntil(Conditions.shellCloses(shell), 120000);

    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    assertNotNull(workspace);
    IWorkspaceRoot root = workspace.getRoot();
    assertNotNull(root);
    IProject project = root.getProject(projectName);
    assertNotNull(project);
    IPath path = project.getLocation();
    path = path.append("config.status");
    File f = new File(path.toOSString());
    assertTrue(f.exists());
    f = new File(path.toOSString());
    assertTrue(f.exists());

    projectExplorer.bot().tree().getTreeItem(projectName).select();
    clickContextMenu(projectExplorer.bot().tree().select(projectName), "Make Targets", "Build...");
    shell = bot.shell("Make Targets");
    shell.activate();
    bot.table().getTableItem("info").select();
    bot.button("Build").click();

    SWTBotView consoleView = viewConsole("CDT Build Console");
    Pattern p = Pattern.compile(".*make info.*", Pattern.DOTALL);
    bot.waitUntil(consoleTextMatches(consoleView, p));

    // Make Targets using right-click on project.
    clickProjectContextMenu("Make Targets", "Build...");
    shell = bot.shell("Make Targets");
    shell.activate();
    bot.table().getTableItem("check").select();
    bot.button("Build").click();
    consoleView = bot.viewByPartName("Console");
    consoleView.setFocus();
    p = Pattern.compile(".*make check.*Making check in src.*", Pattern.DOTALL);
    bot.waitUntil(consoleTextMatches(consoleView, p));
  }
Пример #13
0
  @Test
  public void shouldShowViolationsForSelectionAndChildren() throws Exception {
    SwtBotUtils.openPerspective(bot, ISonarConstants.PERSPECTIVE_ID);

    SWTBotView view = bot.viewById(ViolationsView.ID);
    view.show();

    assertThat(view.bot().tree().hasItems(), is(false));

    new ImportProjectBot().setPath(getProjectPath(PROJECT_NAME)).finish();
    // Enable Sonar nature
    ProjectUtils.configureProject(PROJECT_NAME);

    new PackageExplorerBot()
        .expandAndSelect(
            PROJECT_NAME, "src/main/java", "(default package)", "ClassOnDefaultPackage.java");

    bot.sleep(5000);

    assertThat(view.bot().tree().hasItems(), is(true));
  }
  /** Test show type action on VSM and hide type action. */
  public void testShowHideTypeAction() {
    SWTBotView projectExplorer = bot.viewByTitle("Model Explorer");
    projectExplorer.setFocus();
    projectExplorer.bot().tree().expandNode(getProjectName()).expandNode(VSM_FILE).doubleClick();
    SWTBotEditor activeEditor = bot.activeEditor();
    activeEditor.setFocus();

    String nodeLabel = "platform:/resource/" + getProjectName() + "/" + VSM_FILE;
    SWTBotMenu contextualMenu =
        activeEditor
            .bot()
            .tree()
            .expandNode(nodeLabel)
            .expandNode(GROUP)
            .expandNode(VIEWPOINT_NAME)
            .expandNode(REPRESENTATION_NAME)
            .contextMenu(SHOW_TYPE);
    contextualMenu.click();
    contextualMenu =
        activeEditor
            .bot()
            .tree()
            .expandNode(nodeLabel)
            .expandNode(TYPED_GROUP)
            .expandNode(TYPED_VIEWPOINT_NAME)
            .expandNode(TYPED_REPRESENTATION_NAME)
            .contextMenu(HIDE_TYPE);
    contextualMenu.click();
    contextualMenu =
        activeEditor
            .bot()
            .tree()
            .expandNode(nodeLabel)
            .expandNode(GROUP)
            .expandNode(VIEWPOINT_NAME)
            .expandNode(REPRESENTATION_NAME)
            .contextMenu(SHOW_TYPE);
  }
Пример #15
0
  private void assertVariable(String expected, String variableName, String argument)
      throws CoreException {
    IResource findMember = project.findMember(TEST_FILE);

    SWTBotView explorerView = TestUtil.showExplorerView();
    final ISelectionProvider selectionProvider =
        explorerView.getViewReference().getView(true).getSite().getSelectionProvider();
    final StructuredSelection structuredSelection = new StructuredSelection(findMember);
    PlatformUI.getWorkbench()
        .getDisplay()
        .syncExec(
            new Runnable() {

              @Override
              public void run() {
                selectionProvider.setSelection(structuredSelection);
              }
            });

    IDynamicVariable dynamicVariable =
        VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable(variableName);
    String value = dynamicVariable.getValue(argument);
    assertEquals(expected, value);
  }
Пример #16
0
 public void setSignedOff(boolean signedOff) {
   SWTBotToolbarToggleButton button =
       stagingView.bot().toolbarToggleButtonWithTooltip(UIText.StagingView_Add_Signed_Off_By);
   selectToolbarToggle(button, signedOff);
 }
Пример #17
0
 public void setAuthor(String author) {
   stagingView.bot().textWithLabel(UIText.StagingView_Author).setText(author);
 }
Пример #18
0
 /** Test color by making all events yellow */
 @Test
 public void testYellow() {
   SWTBotView viewBot = fBot.viewById(ColorsView.ID);
   viewBot.setFocus();
   final String insert = "Insert new color setting";
   final String increasePriority = "Increase priority";
   final String decreasePriority = "Decrease priority";
   final String delete = "Delete color setting";
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(insert).click();
   viewBot.toolbarButton(increasePriority).click();
   viewBot.toolbarButton(decreasePriority).click();
   viewBot.toolbarButton(delete).click();
   viewBot.bot().label(0).setFocus();
   viewBot.toolbarButton(delete).click();
   viewBot.bot().label(0).setFocus();
   viewBot.toolbarButton(delete).click();
   final RGB foreground = new RGB(0, 0, 0);
   final RGB background = new RGB(255, 255, 0);
   // Simulate the side effects of picking a color because we cannot
   // control native Color picker dialog in SWTBot.
   final ColorSetting[] cs = new ColorSetting[1];
   UIThreadRunnable.syncExec(
       new VoidResult() {
         @Override
         public void run() {
           cs[0] = new ColorSetting(foreground, background, foreground, new PassAll());
           ColorSettingsManager.setColorSettings(cs);
         }
       });
   final SWTBotTable eventsEditor = SWTBotUtils.activeEventsEditor(fBot).bot().table();
   // should fix race condition of loading the trace
   SWTBotUtils.waitForJobs();
   eventsEditor.select(2);
   final SWTBotTableItem tableItem = eventsEditor.getTableItem(2);
   RGB fgc =
       UIThreadRunnable.syncExec(
           new Result<RGB>() {
             @Override
             public RGB run() {
               return tableItem.widget.getForeground().getRGB();
             }
           });
   RGB bgc =
       UIThreadRunnable.syncExec(
           new Result<RGB>() {
             @Override
             public RGB run() {
               return tableItem.widget.getBackground().getRGB();
             }
           });
   assertEquals("Fg", foreground, fgc);
   assertEquals("Bg", background, bgc);
   // reset color settings
   UIThreadRunnable.syncExec(
       new VoidResult() {
         @Override
         public void run() {
           ColorSettingsManager.setColorSettings(new ColorSetting[0]);
         }
       });
 }
Пример #19
0
 public void setCommitter(String committer) {
   stagingView.bot().textWithLabel(UIText.StagingView_Committer).setText(committer);
 }
Пример #20
0
  /**
   * Link with editor, both ways
   *
   * @throws Exception
   */
  @Test
  @Ignore("'Link with Selection' does not activate editor on selection change (bug 409722).")
  public void testLinkWithSelectionEditor() throws Exception {
    deleteAllProjects();
    shareProjects(repositoryFile);
    SWTBotTree tree = getOrOpenView().bot().tree();
    myRepoViewUtil.getRootItem(tree, repositoryFile).select();
    // the selection should be root
    assertTrue(tree.selection().get(0, 0).startsWith(REPO1));

    SWTBotView view = TestUtil.showExplorerView();
    SWTBotTree projectExplorerTree = view.bot().tree();

    SWTBotTreeItem item =
        getProjectItem(projectExplorerTree, PROJ1).expand().getNode(FOLDER).expand().getNode(FILE1);
    view.show();
    item.doubleClick();

    item =
        getProjectItem(projectExplorerTree, PROJ1).expand().getNode(FOLDER).expand().getNode(FILE2);
    view.show();
    item.doubleClick();
    // now we should have two editors

    // the selection should be still be root
    assertTrue(tree.selection().get(0, 0).startsWith(REPO1));

    // activate the link with selection
    toggleLinkWithSelection();

    bot.editorByTitle(FILE2).show();
    // the selection should have changed to the latest editor
    TestUtil.waitUntilTreeHasSelectedNodeWithText(bot, tree, FILE2, 10000);

    bot.editorByTitle(FILE1).show();
    // selection should have changed
    TestUtil.waitUntilTreeHasSelectedNodeWithText(bot, tree, FILE1, 10000);

    // deactivate the link with editor
    toggleLinkWithSelection();

    bot.editorByTitle(FILE2).show();
    // the selection should be still be test.txt
    TestUtil.waitUntilTreeHasSelectedNodeWithText(bot, tree, FILE1, 10000);

    bot.editorByTitle(FILE1).show();

    myRepoViewUtil
        .getWorkdirItem(tree, repositoryFile)
        .expand()
        .getNode(PROJ1)
        .expand()
        .getNode(FOLDER)
        .expand()
        .getNode(FILE2)
        .select();

    // the editor should still be test.txt
    assertEquals(FILE1, bot.activeEditor().getTitle());

    // activate again
    toggleLinkWithSelection();

    // make sure focus is here
    // tried to remove this waitInUI but failed.
    // tried setting focus, waiting for focus, joining RepositoriesView
    // refresh job
    waitInUI();
    myRepoViewUtil
        .getWorkdirItem(tree, repositoryFile)
        .expand()
        .getNode(PROJ1)
        .expand()
        .getNode(FOLDER)
        .expand()
        .getNode(FILE2)
        .select();
    TestUtil.waitUntilEditorIsActive(bot, bot.editorByTitle(FILE2), 10000);

    myRepoViewUtil
        .getWorkdirItem(tree, repositoryFile)
        .expand()
        .getNode(PROJ1)
        .expand()
        .getNode(FOLDER)
        .expand()
        .getNode(FILE1)
        .select();
    TestUtil.waitUntilEditorIsActive(bot, bot.editorByTitle(FILE1), 10000);

    // deactivate the link with editor
    toggleLinkWithSelection();

    myRepoViewUtil
        .getWorkdirItem(tree, repositoryFile)
        .expand()
        .getNode(PROJ1)
        .expand()
        .getNode(FOLDER)
        .expand()
        .getNode(FILE2)
        .select();
    TestUtil.waitUntilEditorIsActive(bot, bot.editorByTitle(FILE1), 10000);
  }
Пример #21
0
 public void setCommitMessage(String message) {
   stagingView.bot().styledTextWithLabel(UIText.StagingView_CommitMessage).setText(message);
 }
Пример #22
0
 public void setAmend(boolean amend) {
   SWTBotToolbarToggleButton button =
       stagingView.bot().toolbarToggleButtonWithTooltip(UIText.StagingView_Ammend_Previous_Commit);
   selectToolbarToggle(button, amend);
 }
Пример #23
0
 public void commit() throws Exception {
   stagingView.bot().button(UIText.StagingView_Commit).click();
   // wait until commit is completed
   Job.getJobManager().join(JobFamilies.COMMIT, null);
 }
Пример #24
0
  /** Test tool bar buttons "Follow CPU Forward" and "Follow CPU Backward" */
  @Test
  public void testToolBarFollowCPUForwardBackward() {
    /* change window range to 10 ms */
    TmfTimeRange range =
        new TmfTimeRange(
            START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    fBot.waitUntil(ConditionHelpers.windowRange(range));

    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME)));

    /* select first item */
    final SWTBotTree tree = fViewBot.bot().tree();
    tree.pressShortcut(Keystrokes.HOME);

    /* set focus on time graph */
    final TimeGraphControl timegraph =
        fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class));
    UIThreadRunnable.syncExec(
        new VoidResult() {
          @Override
          public void run() {
            timegraph.setFocus();
          }
        });

    /* click "Follow CPU Forward" 3 times */
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME2)));
    fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2"));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID2_TIME2));

    /* shift-click "Follow CPU Forward" 3 times */
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID5_TIME1)));
    fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "5"));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID5_TIME1));

    /* shift-click "Follow CPU Backward" 4 times */
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME1));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME1)));
    fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2"));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID2_TIME1));

    /* click "Follow CPU Forward" 2 times */
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME3)));
    fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2"));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID2_TIME3));

    /* shift-click "Follow CPU Backward" 3 times */
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID1_TIME1));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID1_TIME1)));
    fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "1"));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID1_TIME1));

    /* shift-click "Follow CPU Forward" 4 times */
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
    fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME4));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME4)));
    fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2"));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID2_TIME4));

    /* click "Follow CPU Backward" 5 times */
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
    fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click();
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(START_TIME));
  }
Пример #25
0
 private void timeGraphIsReadyCondition(@NonNull TmfTimeRange selectionRange) {
   IWorkbenchPart part = fViewBot.getViewReference().getPart(false);
   fBot.waitUntil(
       ConditionHelpers.timeGraphIsReadyCondition(
           (AbstractTimeGraphView) part, selectionRange, selectionRange.getEndTime()));
 }
Пример #26
0
  private void testNextPreviousEvent(
      Runnable selectNext,
      Runnable shiftSelectNext,
      Runnable selectPrevious,
      Runnable shiftSelectPrevious) {
    /* change window range to 10 ms */
    TmfTimeRange range =
        new TmfTimeRange(
            START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    fBot.waitUntil(ConditionHelpers.windowRange(range));

    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));

    /* select first item */
    final SWTBotTree tree = fViewBot.bot().tree();
    tree.pressShortcut(Keystrokes.HOME);

    /* set focus on time graph */
    final TimeGraphControl timegraph =
        fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class));
    UIThreadRunnable.syncExec(
        new VoidResult() {
          @Override
          public void run() {
            timegraph.setFocus();
          }
        });

    /* click "Select Next Event" 3 times */
    selectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
    selectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME2, TID1_TIME2));
    selectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME3)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID1_TIME3));

    /* shift-click "Select Next Event" 3 times */
    shiftSelectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME4));
    shiftSelectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME5));
    shiftSelectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME6));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME6)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID1_TIME6));

    /* shift-click "Select Previous Event" 4 times */
    shiftSelectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME5));
    shiftSelectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME4));
    shiftSelectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3));
    shiftSelectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME2));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME2)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID1_TIME2));

    /* click "Select Next Event" 2 times */
    selectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3));
    selectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME4));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME4)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID1_TIME4));

    /* shift-click "Select Previous Event" 3 times */
    shiftSelectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME3));
    shiftSelectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME2));
    shiftSelectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME1));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME1)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID1_TIME1));

    /* shift-click "Select Next Event" 4 times */
    shiftSelectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME2));
    shiftSelectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME3));
    shiftSelectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME4));
    shiftSelectNext.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME5));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME5)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(TID1_TIME5));

    /* click "Select Previous Event" 5 times */
    selectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME4));
    selectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3));
    selectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME2, TID1_TIME2));
    selectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1));
    selectPrevious.run();
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME)));
    assertTrue(
        TmfTraceManager.getInstance()
            .getCurrentTraceContext()
            .getWindowRange()
            .contains(START_TIME));
  }
Пример #27
0
 public boolean getAmend() {
   SWTBotToolbarToggleButton button =
       stagingView.bot().toolbarToggleButtonWithTooltip(UIText.StagingView_Ammend_Previous_Commit);
   return button.isChecked();
 }
Пример #28
0
 public boolean getSignedOff() {
   SWTBotToolbarToggleButton button =
       stagingView.bot().toolbarToggleButtonWithTooltip(UIText.StagingView_Add_Signed_Off_By);
   return button.isChecked();
 }
Пример #29
0
 public void setInsertChangeId(boolean insertChangeId) {
   SWTBotToolbarToggleButton button =
       stagingView.bot().toolbarToggleButtonWithTooltip(UIText.StagingView_Add_Change_ID);
   selectToolbarToggle(button, insertChangeId);
 }
Пример #30
0
 public boolean getInsertChangeId() {
   SWTBotToolbarToggleButton button =
       stagingView.bot().toolbarToggleButtonWithTooltip(UIText.StagingView_Add_Change_ID);
   return button.isChecked();
 }