/** * Creates the {@link AggregatedExceptionSensorData} object for the table input from the list of * same type aggregated objects. * * @param throwableType * Throwable type. * @param dataList * List of {@link AggregatedExceptionSensorData} * @return Aggregated data for the table. */ private AggregatedExceptionSensorData createObjectForOverview(String throwableType, List<AggregatedExceptionSensorData> dataList) { AggregatedExceptionSensorData data = new AggregatedExceptionSensorData(); data.setThrowableType(throwableType); for (AggregatedExceptionSensorData object : dataList) { if (data.getPlatformIdent() == 0) { data.setPlatformIdent(object.getPlatformIdent()); } data.aggregateExceptionData(object); } return data; }
/** * Aggregates the {@link AggregatedExceptionSensorData}. * * @param aggregatedExceptionData * {@link AggregatedExceptionSensorData} */ public void aggregateExceptionData(AggregatedExceptionSensorData aggregatedExceptionData) { if (null != aggregatedExceptionData.getAggregatedIds()) { for (Long id : aggregatedExceptionData.getAggregatedIds()) { aggregatedIds.put(id, Boolean.TRUE); } } super.aggregateInvocationAwareData(aggregatedExceptionData); this.setCreated(this.getCreated() + aggregatedExceptionData.getCreated()); this.setHandled(this.getHandled() + aggregatedExceptionData.getHandled()); this.setPassed(this.getPassed() + aggregatedExceptionData.getPassed()); }
/** * {@inheritDoc} */ @Override public int compare(AggregatedExceptionSensorData o1, AggregatedExceptionSensorData o2) { switch (this) { case CREATED: return Long.compare(o1.getCreated(), o2.getCreated()); case RETHROWN: return Long.compare(o1.getPassed(), o2.getPassed()); case HANDLED: return Long.compare(o1.getHandled(), o2.getHandled()); default: return 0; } } }
/** * Returns the styled text for a specific column. * * @param data * The data object to extract the information from. * @param enumId * The enumeration ID. * @return The styled string containing the information from the data object. */ private StyledString getStyledTextForColumn(AggregatedExceptionSensorData data, Column enumId) { switch (enumId) { case FQN: return new StyledString(data.getThrowableType()); case INVOCATION_AFFILLIATION: int percentage = (int) (data.getInvocationAffiliationPercentage() * 100); int invocations = 0; if (null != data.getInvocationParentsIdSet()) { invocations = data.getInvocationParentsIdSet().size(); } return TextFormatter.getInvocationAffilliationPercentageString(percentage, invocations); case CREATED: return new StyledString(String.valueOf(data.getCreated())); case RETHROWN: return new StyledString(String.valueOf(data.getPassed())); case HANDLED: return new StyledString(String.valueOf(data.getHandled())); default: return new StyledString("error"); } }
/** * {@inheritDoc} */ @Override public IAggregatedData<ExceptionSensorData> getClone(ExceptionSensorData exceptionData) { AggregatedExceptionSensorData clone = new AggregatedExceptionSensorData(); clone.setPlatformIdent(exceptionData.getPlatformIdent()); clone.setSensorTypeIdent(exceptionData.getSensorTypeIdent()); clone.setThrowableType(exceptionData.getThrowableType()); if ((exceptionAggregationType == ExceptionAggregationType.GROUP_EXCEPTION_OVERVIEW) || (exceptionAggregationType == ExceptionAggregationType.DISTINCT_STACK_TRACES)) { clone.setErrorMessage(exceptionData.getErrorMessage()); } if (exceptionAggregationType == ExceptionAggregationType.DISTINCT_STACK_TRACES) { clone.setStackTrace(getCorrectStackTrace(exceptionData.getStackTrace())); } return clone; }
data[3][0] = new AggregatedExceptionSensorData(); data[3][1] = exceptionSensorData; Mockito.when(aggregatedExceptionSensorData.getAggregatedIds()).thenReturn(aggregateId); data[7][0] = new AggregatedExceptionSensorData(); data[7][1] = aggregatedExceptionSensorData;
/** * {@inheritDoc} */ @Override public void aggregate(ExceptionSensorData data) { if (data instanceof AggregatedExceptionSensorData) { aggregateExceptionData((AggregatedExceptionSensorData) data); } else { aggregateExceptionData(data); } }
/** * aggregates the given exception data to this instance. * * @param exceptionData * {@link ExceptionSensorData} */ public void aggregateExceptionData(ExceptionSensorData exceptionData) { if (exceptionData.getExceptionEvent() == ExceptionEvent.CREATED) { created++; } else if (exceptionData.getExceptionEvent() == ExceptionEvent.PASSED) { passed++; } else if (exceptionData.getExceptionEvent() == ExceptionEvent.HANDLED) { handled++; } if (null != exceptionData.getInvocationParentsIdSet()) { for (Long parentId : exceptionData.getInvocationParentsIdSet()) { this.addInvocationParentId(parentId); } } if (0 != exceptionData.getId()) { aggregatedIds.put(exceptionData.getId(), Boolean.TRUE); } }
case CREATED: if (data instanceof AggregatedExceptionSensorData) { if (((AggregatedExceptionSensorData) data).getCreated() >= 0) { return new StyledString(String.valueOf(((AggregatedExceptionSensorData) data).getCreated())); case RETHROWN: if (data instanceof AggregatedExceptionSensorData) { if (((AggregatedExceptionSensorData) data).getPassed() >= 0) { return new StyledString(String.valueOf(((AggregatedExceptionSensorData) data).getPassed())); case HANDLED: if (data instanceof AggregatedExceptionSensorData) { if (((AggregatedExceptionSensorData) data).getHandled() >= 0) { return new StyledString(String.valueOf(((AggregatedExceptionSensorData) data).getHandled()));
case CREATED: if (!rawMode && (data instanceof AggregatedExceptionSensorData)) { return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getCreated())); } else if (ExceptionEvent.CREATED.equals(data.getExceptionEvent())) { return new StyledString("Yes"); return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getPassed())); } else if (ExceptionEvent.PASSED.equals(data.getExceptionEvent())) { return new StyledString("Yes"); return new StyledString(NumberFormatter.formatLong(((AggregatedExceptionSensorData) data).getHandled())); } else if (ExceptionEvent.HANDLED.equals(data.getExceptionEvent())) { return new StyledString("Yes");