/** * Provides all informations of an invocation sequence data. * * <p> * <i> Example URL: /data/invocations/{id}</i> * </p> * * @param id * Invocation sequence ID. * @return detail information of an {@link InvocationSequenceData}. */ @RequestMapping(method = GET, value = "{id}") @ResponseBody public InvocationSequenceData getInvocationSequenceDetails(@PathVariable long id) { InvocationSequenceData template = new InvocationSequenceData(); template.setId(id); InvocationSequenceData result = invocationDataAccessService.getInvocationSequenceDetail(template); return result; }
@BeforeMethod public void init() throws BusinessException { root = new InvocationSequenceData(); root.setId(1); level11 = new InvocationSequenceData(); level11.setId(2); level12 = new InvocationSequenceData(); level12.setId(3); level21 = new InvocationSequenceData(); level21.setId(4); root.getNestedSequences().add(level11); root.getNestedSequences().add(level12); level12.getNestedSequences().add(level21); when(stringValueSource.getStringValues(root, cachedDataService)).thenReturn(new String[] { "node/root/" }); when(stringValueSource.getStringValues(level11, cachedDataService)).thenReturn(new String[] { "node/level_1_1/" }); when(stringValueSource.getStringValues(level12, cachedDataService)).thenReturn(new String[] { "node/level_1_2/" }); when(stringValueSource.getStringValues(level21, cachedDataService)).thenReturn(new String[] { "node/level_2_1/", "node/level_2_1/multiple" }); when(cachedDataService.getApplicationForId(anyInt())).thenReturn(null); when(cachedDataService.getBusinessTransactionForId(anyInt(), anyInt())).thenReturn(null); }
@Test public void dataIsProcessedWhenAllTheConditionsAreFulfilled() { InvocationSequenceData invocationSequenceRoot = new InvocationSequenceData(); invocationSequenceRoot.setId(1); invocationSequenceRoot.setDuration(1500d); cmrProcessor.setBaseline(1000); cmrProcessor.setDiagnosisEnabled(true); cmrProcessor.setInfluxActive(true); boolean canBeProcessed = cmrProcessor.canBeProcessed(invocationSequenceRoot); assertThat("Data must be processed when all the conditions are fulfilled. ", canBeProcessed, is(true)); } }
InvocationSequenceData createSequence(Span span) { InvocationSequenceData data = new InvocationSequenceData(); data.setId(idSequence++); if (span != null) { data.setSpanIdent(span.getSpanIdent()); } data.setTimeStamp(new Timestamp(timeSequence++)); return data; }
@Test public void dataIsNotProcessedWhenTheTimeLowerThanTheBaseline() { InvocationSequenceData invocationSequenceRoot = new InvocationSequenceData(); invocationSequenceRoot.setId(1); invocationSequenceRoot.setDuration(500d); cmrProcessor.setBaseline(1000); cmrProcessor.setDiagnosisEnabled(true); cmrProcessor.setInfluxActive(true); boolean canBeProcessed = cmrProcessor.canBeProcessed(invocationSequenceRoot); assertThat("Data cannot be processed when time is lower than the set in the baseline.", canBeProcessed, is(false)); }
/** * Returns template for {@link InvocationSequenceData}. * * @param invocationSequenceData * Source object. * @param id * Should id be inserted into template. * @param methodIdent * Should methodIdent be inserted into template. * @return Template object. */ protected InvocationSequenceData getTemplate(InvocationSequenceData invocationSequenceData, boolean id, boolean methodIdent) { InvocationSequenceData template = OccurrenceFinderFactory.getEmptyTemplate(invocationSequenceData); if (id && (0 != invocationSequenceData.getId())) { template.setId(invocationSequenceData.getId()); } if (methodIdent && (0 != invocationSequenceData.getMethodIdent())) { template.setMethodIdent(invocationSequenceData.getMethodIdent()); } return template; } }
@BeforeMethod public void init() throws BusinessException { root = new InvocationSequenceData(); root.setId(1); level_1_1 = new InvocationSequenceData(); level_1_1.setId(2); level_1_2 = new InvocationSequenceData(); level_1_2.setId(3); level_2_1 = new InvocationSequenceData(); level_2_1.setId(4); root.getNestedSequences().add(level_1_1); root.getNestedSequences().add(level_1_2);
InvocationSequenceData invData = new InvocationSequenceData(new Timestamp(random.nextLong()), random.nextLong(), random.nextLong(), random.nextLong()); invData.setDuration(random.nextDouble()); invData.setId(random.nextLong()); invData.setEnd(random.nextDouble()); invData.setSqlStatementData(getSqlStatementInstance());
@BeforeMethod public void init() throws BusinessException { root = new InvocationSequenceData(); root.setId(1); level_1_1 = new InvocationSequenceData(); level_1_1.setId(2); level_1_2 = new InvocationSequenceData(); level_1_2.setId(3); level_2_1 = new InvocationSequenceData(); level_2_1.setId(4); root.getNestedSequences().add(level_1_1); root.getNestedSequences().add(level_1_2);
/** * Test that putting one element will return the same {@link IStorageDescriptor} as when get is * executed.. * * @throws IndexingException * If {@link IndexingException} occurs. */ @Test public void putAndGetInvocation() throws IndexingException { IStorageTreeComponent<DefaultData> rootBranch = new StorageBranch<>(new StorageBranchIndexer<>(new ObjectTypeIndexer<>(), false)); InvocationSequenceData invocationSequenceData = new InvocationSequenceData(); invocationSequenceData.setId(1L); IStorageDescriptor storageDescriptor = rootBranch.put(invocationSequenceData); assertThat(storageDescriptor, comparesEqualTo(rootBranch.get(invocationSequenceData))); }
@BeforeMethod public void initSetup() { invocationSequenceRoot = new InvocationSequenceData(); invocationSequenceRoot.setId(FIRST_ID); invocationSequenceRoot.setDuration(ROOT_DURATION); firstChildSequence = new InvocationSequenceData(DEF_DATE, 10, 10, METHOD_IDENT); firstChildSequence.setDuration(FIRST_DURATION); firstChildSequence.setId(SECOND_ID); secondChildSequence = new InvocationSequenceData(DEF_DATE, 20, 20, METHOD_IDENT); secondChildSequence.setDuration(SECOND_DURATION); secondChildSequence.setId(THIRD_ID); timerData.setTimeStamp(new Timestamp(TIMESTAMP_VALUE)); timerData.setPlatformIdent(PLATFORM_IDENT); thirdChildSequence = new InvocationSequenceData(DEF_DATE, 30, 30, METHOD_IDENT); thirdChildSequence.setDuration(THIRD_DURATION); thirdChildSequence.setId(FOURTH_ID); invocationSequenceRoot.getNestedSequences().add(firstChildSequence); invocationSequenceRoot.getNestedSequences().add(secondChildSequence);
/** * Clones invocation sequence. This method returns new object exactly same as the original * object, but with out nested sequences set. * * @return Cloned invocation sequence. */ public InvocationSequenceData getClonedInvocationSequence() { InvocationSequenceData clone = new InvocationSequenceData(this.getTimeStamp(), this.getPlatformIdent(), this.getSensorTypeIdent(), this.getMethodIdent()); clone.setId(this.getId()); clone.setSpanIdent(this.getSpanIdent()); clone.setChildCount(this.getChildCount()); clone.setDuration(this.getDuration()); clone.setEnd(this.getEnd()); clone.setNestedSequences(Collections.<InvocationSequenceData> emptyList()); clone.setParameterContentData(this.getParameterContentData()); clone.setParentSequence(this.getParentSequence()); clone.setPosition(this.getPosition()); clone.setSqlStatementData(this.getSqlStatementData()); clone.setTimerData(this.getTimerData()); clone.setExceptionSensorDataObjects(this.getExceptionSensorDataObjects()); clone.setStart(this.getStart()); clone.setNestedSqlStatements(this.isNestedSqlStatements()); clone.setNestedExceptions(this.isNestedExceptions()); clone.setLoggingData(this.getLoggingData()); clone.setApplicationId(this.getApplicationId()); clone.setBusinessTransactionId(this.getBusinessTransactionId()); return clone; }