Search in sources :

Example 1 with UtilizationDataConfig

use of com.newrelic.agent.config.UtilizationDataConfig in project newrelic-java-agent by newrelic.

the class UtilizationServiceTest method before.

@Before
public void before() {
    MockServiceManager mockServiceManager = new MockServiceManager();
    config = mock(AgentConfig.class);
    MockConfigService configService = new MockConfigService(null);
    configService.setAgentConfig(config);
    ServiceFactory.setServiceManager(mockServiceManager);
    mockServiceManager.setConfigService(configService);
    ThreadService mockThreadService = mock(ThreadService.class);
    mockServiceManager.setThreadService(mockThreadService);
    // Do not make AWS/Azure/GCP/PCF calls. Unit tests should work even without internet connection :)
    when(config.getValue(UtilizationService.DETECT_DOCKER_KEY, true)).thenReturn(false);
    when(config.getValue(UtilizationService.DETECT_AWS_KEY, true)).thenReturn(false);
    when(config.getValue(UtilizationService.DETECT_AZURE_KEY, true)).thenReturn(false);
    when(config.getValue(UtilizationService.DETECT_GOOGLE_CLOUD_PROVIDER_KEY, true)).thenReturn(false);
    when(config.getValue(UtilizationService.DETECT_PIVOTAL_CLOUD_FOUNDRY_KEY, true)).thenReturn(false);
    when(config.getValue(UtilizationService.DETECT_KUBERNETES_KEY, true)).thenReturn(false);
    UtilizationDataConfig utilDataConfig = mock(UtilizationDataConfig.class);
    when(config.getUtilizationDataConfig()).thenReturn(utilDataConfig);
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) ThreadService(com.newrelic.agent.ThreadService) MockServiceManager(com.newrelic.agent.MockServiceManager) MockConfigService(com.newrelic.agent.MockConfigService) UtilizationDataConfig(com.newrelic.agent.config.UtilizationDataConfig) Before(org.junit.Before)

Aggregations

MockConfigService (com.newrelic.agent.MockConfigService)1 MockServiceManager (com.newrelic.agent.MockServiceManager)1 ThreadService (com.newrelic.agent.ThreadService)1 AgentConfig (com.newrelic.agent.config.AgentConfig)1 UtilizationDataConfig (com.newrelic.agent.config.UtilizationDataConfig)1 Before (org.junit.Before)1