/** * {@inheritDoc} */ @Override @MethodLog public void unregister(long platformIdent) throws BusinessException { nextGenInstrumentationManager.unregister(platformIdent); }
/** * {@inheritDoc} */ @Override @MethodLog public AgentConfig register(List<String> definedIPs, String agentName, String version) throws BusinessException { return nextGenInstrumentationManager.register(definedIPs, agentName, version); }
/** * {@inheritDoc} */ @Override @MethodLog public InstrumentationDefinition analyze(long platformIdent, String hash, Type sentType) throws BusinessException { return nextGenInstrumentationManager.analyze(platformIdent, hash, sentType); }
@BeforeMethod public void beforeMethod() { cacheMap = new HashMap<>(); when(nextGenInstrumentationManager.getAgentCacheMap()).thenReturn(cacheMap); when(cacheEntry.getConfigurationHolder()).thenReturn(configurationHolder); when(configurationHolder.getEnvironment()).thenReturn(environment); }
@Test(expectedExceptions = BusinessException.class) public void noMappingsForAgent() throws BusinessException { List<String> definedIPs = mock(List.class); String agentName = "agentName"; String version = "v1"; when(configurationResolver.getEnvironmentForAgent(definedIPs, agentName)).thenThrow(new BusinessException(null)); manager.register(definedIPs, agentName, version); }
/** * {@inheritDoc} */ @Override @MethodLog public Collection<JmxAttributeDescriptor> analyzeJmxAttributes(long platformIdent, Collection<JmxAttributeDescriptor> attributeDescriptors) throws BusinessException { return nextGenInstrumentationManager.analyzeJmxAttributes(platformIdent, attributeDescriptors); }
@Test public void emptyCacheMap() { eventListener.onApplicationEvent(event); verify(nextGenInstrumentationManager).getAgentCacheMap(); verifyNoMoreInteractions(nextGenInstrumentationManager); verifyZeroInteractions(nextGenInstrumentationManager, cacheEntry, configurationHolder, environment, event, objectFactory, updateJob, executor, future); }
@Test public void emptyCacheMap() { eventListener.onApplicationEvent(event); verify(nextGenInstrumentationManager).getAgentCacheMap(); verifyNoMoreInteractions(nextGenInstrumentationManager); verifyZeroInteractions(cacheEntry, configurationHolder, platformIdentDao, platformIdent, configurationResolver, cachedEnvironment, newEnvironment, event, objectFactory, updateJob, executor, future); }
@Test public void emptyCacheMap() { when(event.isProfileActive()).thenReturn(true); when(event.getProfileId()).thenReturn("id_1"); eventListener.onApplicationEvent(event); verify(event).isProfileActive(); verify(nextGenInstrumentationManager).getAgentCacheMap(); verifyNoMoreInteractions(event, nextGenInstrumentationManager); verifyZeroInteractions(cacheEntry, configurationHolder, environment, updateJob, future, objectFactory, executor); }
/** * {@inheritDoc} */ @Override @MethodLog public void instrumentationApplied(long platformId, Map<Long, long[]> methodToSensorMap) { nextGenInstrumentationManager.instrumentationApplied(platformId, methodToSensorMap); }
@BeforeMethod public void beforeMethod() { cacheMap = new HashMap<>(); when(nextGenInstrumentationManager.getAgentCacheMap()).thenReturn(cacheMap); when(cacheEntry.getConfigurationHolder()).thenReturn(configurationHolder); when(configurationHolder.getEnvironment()).thenReturn(environment); }
@Test(expectedExceptions = BusinessException.class) public void agentNotRegistered() throws BusinessException { manager.analyze(ID, HASH, type); }
@Test(expectedExceptions = { BusinessException.class }) public void businessTransactionShouldBeThrownIfNoClassCacheIsAvailable() throws BusinessException { manager.analyzeJmxAttributes(ID, Collections.singleton(descriptor)); } }
@Test public void unregister() throws Exception { long platformId = 10L; manager.unregister(platformId); verify(registrationService).unregisterPlatformIdent(platformId); } }
@Test @SuppressWarnings("unchecked") public void successful() throws Exception { Map<Long, long[]> methodSensorMap = mock(Map.class); agentService.instrumentationApplied(10L, methodSensorMap); verify(instrumentationManager).instrumentationApplied(10L, methodSensorMap); verifyNoMoreInteractions(instrumentationManager); verifyZeroInteractions(messageProvider, methodSensorMap); } }
@Test(expectedExceptions = { BusinessException.class }) public void businessTransactionShouldBeThrownIfNoClassCacheIsAvailable() throws BusinessException { manager.analyze(ID, HASH, type); } }
@Test(expectedExceptions = BusinessException.class) public void agentNotRegistered() throws BusinessException { manager.analyzeJmxAttributes(ID, Collections.singleton(descriptor)); }
@Test public void successful() throws Exception { agentService.unregister(10L); verify(instrumentationManager).unregister(10L); verifyNoMoreInteractions(instrumentationManager); verifyZeroInteractions(messageProvider); } }
@Test public void successful() throws Exception { Type type = mock(Type.class); agentService.analyze(10, "hash", type); verify(instrumentationManager).analyze(10L, "hash", type); verifyNoMoreInteractions(instrumentationManager); verifyZeroInteractions(messageProvider); } }
@Test @SuppressWarnings("unchecked") public void successful() throws Exception { List<JmxAttributeDescriptor> attributeDescriptors = mock(List.class); agentService.analyzeJmxAttributes(10L, attributeDescriptors); verify(instrumentationManager).analyzeJmxAttributes(10L, attributeDescriptors); verifyNoMoreInteractions(instrumentationManager); verifyZeroInteractions(messageProvider, attributeDescriptors); } }