예제 #1
0
 private String getTestItemId(TaskDataDto tdd) {
   StringBuilder sessionIds = new StringBuilder();
   for (String id : tdd.getSessionIds()) {
     sessionIds.append(id);
   }
   return tdd.getDescription() + tdd.getTaskName() + sessionIds.toString();
 }
예제 #2
0
  public void addTestInfo(TaskDataDto test, Map<String, TestInfoDto> testInfoMap) {

    TreeItem testItem = getTestItem(test);

    String testInfoId = testItem.getKey() + TEST_INFO;
    if (treeStore.findModelWithKey(testInfoId) != null) {
      return;
    }

    String testItemName = getTestItemName(test);
    TreeItem testInfo = new TreeItem(testInfoId);
    testInfo.put(NAME, TEST_INFO);
    testInfo.put(TEST_DESCRIPTION, test.getDescription());
    testInfo.put(TEST_NAME, testItemName);
    treeStore.insert(testItem, 0, testInfo);

    TreeItem clock = new TreeItem(testItem.getKey() + "Clock");
    clock.put(NAME, "Clock");
    clock.put(TEST_DESCRIPTION, test.getDescription());
    clock.put(TEST_NAME, testItemName);
    clock.put(TEST_INFO, TEST_INFO);
    for (SessionDataDto session : chosenSessions) {
      if (testInfoMap.get(session.getSessionId()) != null)
        clock.put(
            SESSION_HEADER + session.getSessionId(),
            testInfoMap.get(session.getSessionId()).getClock());
    }
    treeStore.add(testInfo, clock);

    TreeItem termination = new TreeItem(testItem.getKey() + "Termination");
    termination.put(NAME, "Termination");
    termination.put(TEST_DESCRIPTION, test.getDescription());
    termination.put(TEST_NAME, testItemName);
    termination.put(TEST_INFO, TEST_INFO);
    for (SessionDataDto session : chosenSessions) {
      if (testInfoMap.get(session.getSessionId()) != null)
        termination.put(
            SESSION_HEADER + session.getSessionId(),
            testInfoMap.get(session.getSessionId()).getTermination());
    }
    treeStore.add(testInfo, termination);

    TreeItem startTime = new TreeItem(testItem.getKey() + "Start time");
    startTime.put(NAME, "Start time");
    startTime.put(TEST_DESCRIPTION, test.getDescription());
    startTime.put(TEST_NAME, testItemName);
    startTime.put(TEST_INFO, TEST_INFO);
    for (SessionDataDto session : chosenSessions) {
      if (testInfoMap.get(session.getSessionId()) != null) {
        Date date = testInfoMap.get(session.getSessionId()).getStartTime();
        startTime.put(SESSION_HEADER + session.getSessionId(), dateFormatter.format(date));
      }
    }
    treeStore.add(testInfo, startTime);
  }
예제 #3
0
파일: Trends.java 프로젝트: Gorbush/jagger
    private void makeSelectionForMetricPanel(
        Set<MetricNameDto> metricTempSet, MetricPanel metricPanel, List<TaskDataDto> result) {

      if (!metricTempSet.isEmpty()) {
        for (MetricNameDto metricName : metricTempSet) {
          for (TaskDataDto mN : result) {
            if (metricName.getTests().getTaskName().equals(mN.getTaskName())) {
              metricPanel.setSelected(new MetricNameDto(mN, metricName.getName()));
            }
          }
        }
      }
    }
예제 #4
0
파일: Trends.java 프로젝트: Gorbush/jagger
 private void makeSelectionForTaskDetailsTree(
     Set<PlotNameDto> plotTempSet,
     SelectionModel<PlotNameDto> plotNameSelectionModel,
     List<TaskDataDto> result) {
   if (!plotTempSet.isEmpty()) {
     for (PlotNameDto plotName : plotTempSet) {
       for (TaskDataDto td : result) {
         if (plotName.getTest().getTaskName().equals(td.getTaskName())) {
           plotNameSelectionModel.setSelected(new PlotNameDto(td, plotName.getPlotName()), true);
         }
       }
     }
   }
 }
예제 #5
0
파일: Trends.java 프로젝트: Gorbush/jagger
    private void ifItWasLink(
        List<TaskDataDto> result,
        MetricPanel metricPanel,
        TaskDataTreeViewModel taskDataTreeViewModel) {

      Set<MetricNameDto> metricsToSelect = new HashSet<MetricNameDto>();
      Set<PlotNameDto> trendsToSelect = new HashSet<PlotNameDto>();

      for (TaskDataDto taskDataDto : result) {
        for (TestsMetrics testMetric : place.getSelectedTestsMetrics()) {
          if (testMetric.getTestName().equals(taskDataDto.getTaskName())) {
            // add metrics
            for (String metricName : testMetric.getMetrics()) {
              MetricNameDto meticDto = new MetricNameDto();
              meticDto.setName(metricName);
              meticDto.setTests(taskDataDto);
              metricsToSelect.add(meticDto);
            }

            // add plots
            for (String trendsName : testMetric.getTrends()) {
              PlotNameDto plotNameDto = new PlotNameDto(taskDataDto, trendsName);
              trendsToSelect.add(plotNameDto);
            }
          }
        }
      }

      MetricNameDto fireMetric = null;
      if (!metricsToSelect.isEmpty()) fireMetric = metricsToSelect.iterator().next();

      for (MetricNameDto metric : metricsToSelect) {
        metricPanel.setSelected(metric);
      }
      metricPanel.addSelectionListener(new MetricsSelectionChangedHandler());

      if (fireMetric != null) metricPanel.setSelected(fireMetric);

      PlotNameDto firePlot = null;
      if (!trendsToSelect.isEmpty()) firePlot = trendsToSelect.iterator().next();

      for (PlotNameDto plotNameDto : trendsToSelect) {
        taskDataTreeViewModel.getSelectionModel().setSelected(plotNameDto, true);
      }
      taskDataTreeViewModel
          .getSelectionModel()
          .addSelectionChangeHandler(new TaskPlotSelectionChangedHandler());

      if (firePlot != null) taskDataTreeViewModel.getSelectionModel().setSelected(firePlot, true);
    }
예제 #6
0
  private TreeItem getTestItem(TaskDataDto tdd) {

    String key = getTestItemId(tdd);
    TreeItem taskItem = treeStore.findModelWithKey(key);
    if (taskItem != null) {
      return taskItem;
    }

    TreeItem description = getTestDescriptionItem(tdd.getDescription());

    taskItem = new TreeItem(key);
    taskItem.put(NAME, getTestItemName(tdd));
    taskItem.put(TEST_DESCRIPTION, tdd.getDescription());
    treeStore.add(description, taskItem);
    return taskItem;
  }
예제 #7
0
파일: Trends.java 프로젝트: Gorbush/jagger
    private void makeSelectionOnTaskDataGrid(
        MultiSelectionModel<TaskDataDto> model, List<TaskDataDto> tests) {

      if (selectTests) {
        if (!previousSelectedSet.isEmpty()) {
          for (TaskDataDto taskDataDto : tests) {
            for (TaskDataDto taskDataPrevious : previousSelectedSet) {
              if (taskDataDto.getTaskName().equals(taskDataPrevious.getTaskName())) {
                model.setSelected(taskDataDto, true);
              }
            }
          }
          SelectionChangeEvent.fire(testDataGrid.getSelectionModel());
        }

      } else {
        Set<TestsMetrics> testsMetrics = place.getSelectedTestsMetrics();
        for (TaskDataDto taskDataDto : tests) {
          for (TestsMetrics testMetric : testsMetrics) {
            if (testMetric.getTestName().equals(taskDataDto.getTaskName())) {
              model.setSelected(taskDataDto, true);
            }
          }
        }
        model.addSelectionChangeHandler(new TestSelectChangeHandler());

        SelectionChangeEvent.fire(model);
      }
      previousSelectedSet.clear();
    }
예제 #8
0
파일: Trends.java 프로젝트: Gorbush/jagger
  @UiHandler("getHyperlink")
  void getHyperlink(ClickEvent event) {
    MultiSelectionModel<SessionDataDto> sessionModel =
        (MultiSelectionModel) sessionsDataGrid.getSelectionModel();
    MultiSelectionModel<TaskDataDto> testModel =
        (MultiSelectionModel) testDataGrid.getSelectionModel();

    Set<SessionDataDto> sessions = sessionModel.getSelectedSet();

    Set<TaskDataDto> tests = testModel.getSelectedSet();

    Set<MetricNameDto> metrics = metricPanel.getSelected();

    TaskDataTreeViewModel taskDataTreeViewModel =
        (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel();
    Set<PlotNameDto> trends = taskDataTreeViewModel.getSelectionModel().getSelectedSet();

    HashSet<String> sessionsIds = new HashSet<String>();
    HashSet<TestsMetrics> testsMetricses = new HashSet<TestsMetrics>(tests.size());
    HashMap<String, TestsMetrics> map = new HashMap<String, TestsMetrics>(tests.size());

    for (SessionDataDto session : sessions) {
      sessionsIds.add(session.getSessionId());
    }

    for (TaskDataDto taskDataDto : tests) {
      TestsMetrics testsMetrics =
          new TestsMetrics(taskDataDto.getTaskName(), new HashSet<String>(), new HashSet<String>());
      testsMetricses.add(testsMetrics);
      map.put(taskDataDto.getTaskName(), testsMetrics);
    }

    for (MetricNameDto metricNameDto : metrics) {
      map.get(metricNameDto.getTests().getTaskName()).getMetrics().add(metricNameDto.getName());
    }

    for (PlotNameDto plotNameDto : trends) {
      map.get(plotNameDto.getTest().getTaskName()).getTrends().add(plotNameDto.getPlotName());
    }

    TrendsPlace newPlace =
        new TrendsPlace(
            mainTabPanel.getSelectedIndex() == 0
                ? NameTokens.SUMMARY
                : mainTabPanel.getSelectedIndex() == 1 ? NameTokens.TRENDS : NameTokens.METRICS);

    newPlace.setSelectedSessionIds(sessionsIds);
    newPlace.setSelectedTestsMetrics(testsMetricses);
    newPlace.setSessionTrends(sessionPlotPanel.getSelected());

    String linkText =
        Window.Location.getHost()
            + Window.Location.getPath()
            + Window.Location.getQueryString()
            + "#"
            + new JaggerPlaceHistoryMapper().getToken(newPlace);
    linkText = URL.encode(linkText);

    // create a dialog for copy link
    final DialogBox dialog = new DialogBox(false, true);
    dialog.setText("Share link");
    dialog.setModal(true);
    dialog.setAutoHideEnabled(true);
    dialog.setPopupPosition(event.getClientX(), event.getClientY());

    final TextArea textArea = new TextArea();
    textArea.setText(linkText);
    textArea.setWidth("300px");
    textArea.setHeight("40px");
    // select text
    Scheduler.get()
        .scheduleDeferred(
            new Scheduler.ScheduledCommand() {
              @Override
              public void execute() {
                textArea.setVisible(true);
                textArea.setFocus(true);
                textArea.selectAll();
              }
            });

    dialog.add(textArea);

    dialog.show();
  }
예제 #9
0
 private String getTestItemName(TaskDataDto tdd) {
   if (webClientProperties.isShowOnlyMatchedTests()) return tdd.getTaskName();
   else return tdd.getTaskName() + " from sessions: " + tdd.getSessionIds();
 }