Example #1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
  /**
   * Updates the configuration from the filter config.
   *
   * @param filterConfig
   */
  @SuppressWarnings("unchecked")
  public void updateConfigration(FilterConfig filterConfig) {
    Enumeration<String> paramEnum = filterConfig.getInitParameterNames();
    while (paramEnum.hasMoreElements()) {
      String paramName = paramEnum.nextElement();
      if (paramName.startsWith("r")) {
        try {
          if (!runOptions.containsKey(paramName)) throw new Exception("Invalid Parameter Name");
          runOptions.put(paramName, Boolean.parseBoolean(filterConfig.getInitParameter(paramName)));
        } catch (Exception e) {
          log.warn("Init Parameter [" + paramName + "] is invalid or could not be set.", e);
        }
      } else if (paramName.startsWith("b")) {
        try {
          if (!batchOptions.containsKey(paramName)) throw new Exception("Invalid Parameter Name");
          batchOptions.put(paramName, Integer.parseInt(filterConfig.getInitParameter(paramName)));
        } catch (Exception e) {
          log.warn("Init Parameter [" + paramName + "] is invalid or could not be set.", e);
        }
      } else if (paramName.startsWith("p")) {
        try {
          if (!parameterNames.containsKey(paramName)) throw new Exception("Invalid Parameter Name");
          parameterNames.put(paramName, filterConfig.getInitParameter(paramName));
        } catch (Exception e) {
          log.warn("Init Parameter [" + paramName + "] is invalid or could not be set.", e);
        }
      } else if ("listenerClassName".equals(paramName)) {
        listenerClassName = filterConfig.getInitParameter(paramName);
      } else if ("agentLogLevel".equals(paramName)) {
        try {
          agentLogLevel = Integer.parseInt(filterConfig.getInitParameter(paramName));
        } catch (Exception e) {
          log.warn("Agent Log Level Could Not Be Set. Defaulting to [" + agentLogLevel + "].", e);
        }

      } else {
        log.warn("Init Parameter [" + paramName + "] was not recognized.");
      }
    }
    log.info("Completed AjaxMetrics Filter Configuration. Config is:\n" + toString());
    inited = true;
  }
Example #3
0
  public boolean isStillMocked(@Nullable Object instance, @Nonnull String classDesc) {
    Class<?> targetClass;

    if (instance == null) {
      targetClass = ClassLoad.loadByInternalName(classDesc);
      return isClassAssignableTo(mockedClasses, targetClass);
    }

    targetClass = instance.getClass();
    return mockedTypesAndInstances.containsKey(targetClass) || isInstanceOfMockedClass(instance);
  }