/** * {@inheritDoc} */ @Override public BusinessTransactionData getBusinessTransactionForId(int appId, int businessTxId) { return businessTransactions.get(new Pair<Integer, Integer>(appId, businessTxId)); } }
/** * {@inheritDoc} */ @Override public BusinessTransactionData getBusinessTransactionForId(int appId, int businessTxId) { return businessTransactions.get(new Pair<Integer, Integer>(appId, businessTxId)); }
/** * {@inheritDoc} */ @Override public BusinessTransactionData getBusinessTransactionForId(int appId, int businessTxId) { Pair<Integer, Integer> keyPair = new Pair<Integer, Integer>(appId, businessTxId); if (!businessTransactionsMap.containsKey(keyPair)) { refreshBusinessContext(); } BusinessTransactionData businessTxData = businessTransactionsMap.get(keyPair); return businessTxData; }
/** * Validates the content of the email addresses input field checking whether the e-mails have a * correct syntax. * * @return Returns a integer-string pair indicating the line number and e-mail address that is * not correct. If all e-mail addresses have a correct syntax, then this method returns * <code>null</code>. */ private Pair<Integer, String> checkEmailText() { int i = 0; for (String address : getEmailAddresses()) { if (!address.isEmpty() && !EMailUtils.isValidEmailAddress(address)) { return new Pair<Integer, String>(i + 1, address); } i++; } return null; }
/** * Handles teh arrival of a new PageLoadRequest. * * @param plr * the received pageloadrequest */ private void newPageLoadRequestReceived(PageLoadRequest plr) { Long sessionID = plr.getOwningSpan().getSessionId(); Long tabID = plr.getOwningSpan().getTabId(); Pair<Long, Long> plrSessionTabId = new Pair<Long, Long>(sessionID, tabID); pageLoadRequestCache.put(plrSessionTabId, plr); Iterator<AbstractEUMSpanDetails> it = missingPageLoadRequestsMap.get(plrSessionTabId).iterator(); while (it.hasNext()) { AbstractEUMSpanDetails next = it.next(); it.remove(); tryPointBuildingForPendingElement(next); } }
/** * Reloads the business context data. */ private void refreshBusinessContext() { applicationMap.clear(); businessTransactionsMap.clear(); for (BusinessTransactionData businessTx : businessContextService.getBusinessTransactions()) { businessTransactionsMap.put(new Pair<Integer, Integer>(businessTx.getApplication().getId(), businessTx.getId()), businessTx); } for (ApplicationData application : businessContextService.getApplications()) { applicationMap.put(application.getId(), application); } }
/** * Sets {@link #businessTransactions}. * * @param businessTransactions * A collection of {@link BusinessTransactionData} instances. */ public void setBusinessTransactions(Collection<BusinessTransactionData> businessTransactions) { for (BusinessTransactionData businessTx : businessTransactions) { this.businessTransactions.put(new Pair<Integer, Integer>(businessTx.getApplication().getId(), businessTx.getId()), businessTx); this.applications.put(businessTx.getApplication().getId(), businessTx.getApplication()); } }
/** * Get key for aggregation. * * @param invocationSequenceData * invocationSequenceData to key should be determined * @return key as object */ public Object getAggregationKey(InvocationSequenceData invocationSequenceData) { if (InvocationSequenceDataHelper.hasSQLData(invocationSequenceData)) { return new Pair<Long, String>(invocationSequenceData.getMethodIdent(), invocationSequenceData.getSqlStatementData().getSql()); } else if (InvocationSequenceDataHelper.hasHttpTimerData(invocationSequenceData)) { return new Pair<Long, String>(invocationSequenceData.getMethodIdent(), ((HttpTimerData) invocationSequenceData.getTimerData()).getHttpInfo().getUri()); } else { return invocationSequenceData.getMethodIdent(); } }
@SuppressWarnings("unchecked") @Override public void onRemoval(RemovalNotification<AbstractEUMSpanDetails, Pair<Boolean, AbstractEUMPointBuilder>> notification) { AbstractEUMSpanDetails element = notification.getKey(); synchronized (element) { AbstractEUMPointBuilder builder = notification.getValue().getSecond(); Long sessId = element.getOwningSpan().getSessionId(); Long tabId = element.getOwningSpan().getTabId(); Pair<Long, Long> plrSessionTabId = new Pair<Long, Long>(sessId, tabId); missingSessionInfosMap.remove(sessId, element); missingPageLoadRequestsMap.remove(plrSessionTabId, element); // Force a write even if data is still missing in case of an cache // eviction because of the timeout if (notification.getCause() != RemovalCause.EXPLICIT) { PageLoadRequest plr = pageLoadRequestCache.getIfPresent(plrSessionTabId); UserSessionInfo sessionInfo = sessionInfoCache.getIfPresent(sessId); dataPointsToWrite.addAll(builder.build(sessionInfo, plr, element)); } } } }).build();
/** * {@inheritDoc} */ @Override public BusinessTransactionData registerBusinessTransaction(ApplicationData application, BusinessTransactionDefinition businessTransactionDefinition, String businessTransactionName) { int businessTxId = deriveInstanceId(businessTransactionName, businessTransactionDefinition.getId()); BusinessTransactionData businessTransaction = getBusinessTransactionForId(application.getId(), businessTxId); if (null == businessTransaction) { businessTransaction = new BusinessTransactionData(businessTxId, businessTransactionDefinition.getId(), application, businessTransactionName); Pair<Integer, Integer> key = new Pair<Integer, Integer>(application.getId(), businessTransaction.getId()); BusinessTransactionData existingBusinessTx = businessTransactions.putIfAbsent(key, businessTransaction); if (null != existingBusinessTx) { businessTransaction = existingBusinessTx; } } return businessTransaction; }
Pair<Long, Long> plrSessionTabId = new Pair<Long, Long>(sessId, tabId);
@Test private void ifTheAggregatedObjectHasHttpTimerDataAndIsDefinedInTheMapItMustBeAggregatedToTheDiagnosisAggregator() { InvocationSequenceData invocationSequenceData = new InvocationSequenceData(new Timestamp(10L), 10L, 20L, 2L); diagnosisDataAggregationPerformer = new DiagnosisDataAggregationPerformer(); HttpTimerData timerData = new HttpTimerData(new Timestamp(10), 10, 10, 108L); HttpInfo httpInfo = new HttpInfo("URI", "requestMethod", "headerValue"); timerData.setHttpInfo(httpInfo); invocationSequenceData.setTimerData(timerData); Object key = new Pair<Long, String>(invocationSequenceData.getMethodIdent(), ((HttpTimerData) invocationSequenceData.getTimerData()).getHttpInfo().getUri()); diagnosisDataAggregationPerformer.diagnosisDataAggregationMap.put(key, alreadyAggregatedObject); diagnosisDataAggregationPerformer.aggregateInvocationSequenceData(invocationSequenceData); verify(alreadyAggregatedObject, times(1)).aggregate(invocationSequenceData); } }
@Test private void ifTheAggregatedObjectHasSQLDataAndIsDefinedInTheMapItMustBeAggregatedToTheDiagnosisAggregator() { InvocationSequenceData invocationSequenceData = new InvocationSequenceData(new Timestamp(10L), 10L, 20L, 2L); diagnosisDataAggregationPerformer = new DiagnosisDataAggregationPerformer(); SqlStatementData sqlStatementData = new SqlStatementData(new Timestamp(10), 10, 10, 108L); sqlStatementData.setCount(1); sqlStatementData.setSql("blahblahblah"); invocationSequenceData.setSqlStatementData(sqlStatementData); HttpTimerData timerData = new HttpTimerData(new Timestamp(10), 10, 10, 108L); invocationSequenceData.setTimerData(timerData); Object key = new Pair<Long, String>(invocationSequenceData.getMethodIdent(), invocationSequenceData.getSqlStatementData().getSql()); diagnosisDataAggregationPerformer.diagnosisDataAggregationMap.put(key, alreadyAggregatedObject); diagnosisDataAggregationPerformer.aggregateInvocationSequenceData(invocationSequenceData); verify(alreadyAggregatedObject, times(1)).aggregate(invocationSequenceData); }
@Test private void ifTheAggregatedObjectIsNotDefineInTheMapItMustBeAggregated() { InvocationSequenceData invocationSequenceData = new InvocationSequenceData(new Timestamp(10L), 10L, 20L, 2L); diagnosisDataAggregationPerformer = new DiagnosisDataAggregationPerformer(); SqlStatementData sqlStatementData = new SqlStatementData(new Timestamp(10), 10, 10, 108L); sqlStatementData.setCount(1); sqlStatementData.setSql("blahblahblah"); invocationSequenceData.setSqlStatementData(sqlStatementData); TimerData timerData = new TimerData(new Timestamp(10), 10, 10, 108L); invocationSequenceData.setTimerData(timerData); Object key = new Pair<Long, String>(invocationSequenceData.getMethodIdent(), invocationSequenceData.getSqlStatementData().getSql()); AggregatedDiagnosisData alreadyAggregatedObject = new AggregatedDiagnosisData(SourceType.TIMERDATA, invocationSequenceData, key); diagnosisDataAggregationPerformer.diagnosisDataAggregationMap.put(key, alreadyAggregatedObject); InvocationSequenceData secondInvocationSequenceData = new InvocationSequenceData(new Timestamp(10L), 10L, 20L, 2L); secondInvocationSequenceData.setTimerData(timerData); List<InvocationSequenceData> invocationSequenceDataList = new ArrayList<>(); invocationSequenceDataList.add(invocationSequenceData); invocationSequenceDataList.add(secondInvocationSequenceData); diagnosisDataAggregationPerformer.aggregateInvocationSequenceDataList(invocationSequenceDataList); List<AggregatedDiagnosisData> resultList = diagnosisDataAggregationPerformer.getAggregationResultList(); assertThat("The list must have 2 aggregated objects", resultList.size(), is(2)); assertThat("The first aggregated object must have the same method ident that the invocationSequenceData", resultList.get(0).getMethodIdent(), equalTo(invocationSequenceData.getMethodIdent())); assertThat("The second aggregated object must have the same method ident that the secondInvocationSequenceData", resultList.get(1).getMethodIdent(), equalTo(secondInvocationSequenceData.getMethodIdent())); } }
when(rootCause.getMethodIdent()).thenReturn(detectedProblemContext.getNestedSequences().get(0).getMethodIdent()); when(rootCause.size()).thenReturn(2); Pair<Long, String> pair = new Pair<Long, String>(detectedProblemContext.getNestedSequences().get(0).getMethodIdent(), "somethingsomething"); when(rootCause.getAggregationKey()).thenReturn(pair); when(problemContext.getCommonContext()).thenReturn(commonContext);
when(rootCause.getMethodIdent()).thenReturn(detectedProblemContext.getNestedSequences().get(0).getMethodIdent()); when(rootCause.size()).thenReturn(2); Pair<Long, String> pair = new Pair<Long, String>(detectedProblemContext.getNestedSequences().get(0).getMethodIdent(), "n.a."); when(rootCause.getAggregationKey()).thenReturn(pair); when(problemContext.getCommonContext()).thenReturn(commonContext);
textLabel.setText(""); externalServiceLabelMap.put(service, new Pair<>(iconLabel, textLabel));