/** * {@inheritDoc} */ @Override public boolean canBeProcessed(DefaultData defaultData) { if (null == defaultData) { return false; } else if (!(defaultData instanceof MethodSensorData)) { // we only put to buffer method sensor data return false; } else if (defaultData instanceof InvocationAwareData) { // we don't put to buffer elements that are inside of invocation if (!((InvocationAwareData) defaultData).isOnlyFoundOutsideInvocations()) { return false; } } else if (defaultData instanceof InvocationSequenceData) { // we don't put to buffer invocations that are not root if (((InvocationSequenceData) defaultData).getParentSequence() != null) { return false; } } return true; }
/** * {@inheritDoc} */ @Override public DetailsTable generate(DefaultData defaultData, RepositoryDefinition repositoryDefinition, Composite parent, FormToolkit toolkit) { InvocationAwareData invocationAwareData = (InvocationAwareData) defaultData; DetailsTable table = new DetailsTable(parent, toolkit, "Invocation Affiliation", 1); table.addContentRow("In Invocations:", null, new DetailsCellContent[] { new YesNoDetailsCellContent(!invocationAwareData.isOnlyFoundOutsideInvocations()) }); if (!invocationAwareData.isOnlyFoundOutsideInvocations()) { int percentage = (int) (invocationAwareData.getInvocationAffiliationPercentage() * 100); int invocations = invocationAwareData.getInvocationParentsIdSet().size(); String affiliation = TextFormatter.getInvocationAffilliationPercentageString(percentage, invocations).getString(); table.addContentRow("Affiliation:", null, new DetailsCellContent[] { new DetailsCellContent(affiliation) }); } return table; }
when(invocationAwareData.isOnlyFoundOutsideInvocations()).thenReturn(false); processor.process(invocationAwareData, entityManager); verifyZeroInteractions(buffer, entityManager); when(invocationAwareData.isOnlyFoundOutsideInvocations()).thenReturn(true); processor.process(invocationAwareData, entityManager); ArgumentCaptor<IBufferElement> captor = ArgumentCaptor.forClass(IBufferElement.class);
when(invocationAwareData.isOnlyFoundOutsideInvocations()).thenReturn(false); processor.process(invocationAwareData, entityManager); when(invocationAwareData.isOnlyFoundOutsideInvocations()).thenReturn(true); processor.process(invocationAwareData, entityManager); verifyZeroInteractions(log, indexingTree, entityManager); when(invocationAwareData.isOnlyFoundOutsideInvocations()).thenReturn(false); processor.process(invocationAwareData, entityManager); verify(indexingTree, times(1)).put(invocationAwareData);
if (selectedObject instanceof InvocationAwareData) { InvocationAwareData invocationAwareData = (InvocationAwareData) selectedObject; if (!invocationAwareData.isOnlyFoundOutsideInvocations()) { return true;