Search in sources :

Example 16 with ConfigService

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

the class NormalizedTransactionTrace method createServiceManager.

private static void createServiceManager(Map<String, Object> map) throws Exception {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.start();
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(map), map);
    serviceManager.setConfigService(configService);
    MockCoreService agent = new MockCoreService();
    serviceManager.setCoreService(agent);
    TransactionService transactionService = new TransactionService();
    serviceManager.setTransactionService(transactionService);
    TransactionTraceService transactionTraceService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(transactionTraceService);
    AttributesService attrService = new AttributesService();
    serviceManager.setAttributesService(attrService);
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    MockRPMService rpmService = new MockRPMService();
    rpmService.setApplicationName("Unit Test");
    rpmServiceManager.setRPMService(rpmService);
    NormalizationService normalizationService = new NormalizationServiceImpl();
    serviceManager.setNormalizationService(normalizationService);
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) TransactionService(com.newrelic.agent.TransactionService) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) MockCoreService(com.newrelic.agent.MockCoreService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) NormalizationService(com.newrelic.agent.normalization.NormalizationService) MockRPMService(com.newrelic.agent.MockRPMService) NormalizationServiceImpl(com.newrelic.agent.normalization.NormalizationServiceImpl)

Example 17 with ConfigService

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

the class RandomTransactionSamplerTest method createServiceManager.

private void createServiceManager() throws Exception {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    Map<String, Object> configMap = createConfigMap();
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(configMap), configMap);
    serviceManager.setConfigService(configService);
    DatabaseService dbService = new DatabaseService();
    serviceManager.setDatabaseService(dbService);
    TransactionTraceService ttService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(ttService);
    AttributesService attService = new AttributesService();
    serviceManager.setAttributesService(attService);
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) DatabaseService(com.newrelic.agent.database.DatabaseService)

Example 18 with ConfigService

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

the class TransactionTraceBucketTest method createServiceManager.

private void createServiceManager(Map<String, Object> configMap) throws Exception {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    AgentConfig agentConfig = createConfig(configMap);
    ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, configMap);
    serviceManager.setConfigService(configService);
    DatabaseService dbService = new DatabaseService();
    serviceManager.setDatabaseService(dbService);
    TransactionTraceService ttService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(ttService);
    AttributesService attService = new AttributesService();
    serviceManager.setAttributesService(attService);
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) ConfigService(com.newrelic.agent.config.ConfigService) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) DatabaseService(com.newrelic.agent.database.DatabaseService)

Example 19 with ConfigService

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

the class HibernateStatsTest method beforeClass.

@BeforeClass
public static void beforeClass() {
    final NoopSamplerService samplerService = new NoopSamplerService() {

        @Override
        public Closeable addSampler(Runnable sampler, long period, TimeUnit timeUnit) {
            samplers.add(sampler);
            return null;
        }
    };
    ConfigService configService = spy(ServiceFactory.getConfigService());
    AgentConfigImpl agentConfig = spy((AgentConfigImpl) configService.getDefaultAgentConfig());
    doReturn(true).when(agentConfig).getValue("instrumentation.hibernate.stats_sampler.enabled", false);
    doReturn(agentConfig).when(configService).getDefaultAgentConfig();
    ServiceManager serviceManager = spy(ServiceFactory.getServiceManager());
    doReturn(samplerService).when(serviceManager).getSamplerService();
    doReturn(configService).when(serviceManager).getConfigService();
    ServiceFactory.setServiceManager(serviceManager);
}
Also used : AgentConfigImpl(com.newrelic.agent.config.AgentConfigImpl) ConfigService(com.newrelic.agent.config.ConfigService) ServiceManager(com.newrelic.agent.service.ServiceManager) TimeUnit(java.util.concurrent.TimeUnit) NoopSamplerService(com.newrelic.agent.samplers.NoopSamplerService) BeforeClass(org.junit.BeforeClass)

Example 20 with ConfigService

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

the class ProfileTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.start();
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    Map<String, Object> map = new HashMap<>();
    AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(map);
    ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, map);
    serviceManager.setConfigService(configService);
    TransactionService transactionService = new TransactionService();
    serviceManager.setTransactionService(transactionService);
    threadNameNormalizer = new ThreadNameNormalizer(agentConfig, threadService);
}
Also used : ThreadService(com.newrelic.agent.ThreadService) AgentConfig(com.newrelic.agent.config.AgentConfig) ConfigService(com.newrelic.agent.config.ConfigService) TransactionService(com.newrelic.agent.TransactionService) HashMap(java.util.HashMap) MockServiceManager(com.newrelic.agent.MockServiceManager) ThreadNameNormalizer(com.newrelic.agent.threads.ThreadNameNormalizer) BeforeClass(org.junit.BeforeClass)

Aggregations

ConfigService (com.newrelic.agent.config.ConfigService)95 MockServiceManager (com.newrelic.agent.MockServiceManager)57 TransactionService (com.newrelic.agent.TransactionService)36 AgentConfig (com.newrelic.agent.config.AgentConfig)36 TransactionTraceService (com.newrelic.agent.trace.TransactionTraceService)32 ThreadService (com.newrelic.agent.ThreadService)31 AttributesService (com.newrelic.agent.attributes.AttributesService)30 MockRPMServiceManager (com.newrelic.agent.MockRPMServiceManager)29 HarvestService (com.newrelic.agent.HarvestService)24 MockHarvestService (com.newrelic.agent.MockHarvestService)23 HashMap (java.util.HashMap)23 StatsService (com.newrelic.agent.stats.StatsService)21 MockCoreService (com.newrelic.agent.MockCoreService)20 MockRPMService (com.newrelic.agent.MockRPMService)20 SqlTraceServiceImpl (com.newrelic.agent.sql.SqlTraceServiceImpl)20 StatsServiceImpl (com.newrelic.agent.stats.StatsServiceImpl)20 SqlTraceService (com.newrelic.agent.sql.SqlTraceService)19 ErrorServiceImpl (com.newrelic.agent.errors.ErrorServiceImpl)17 Test (org.junit.Test)15 EnvironmentService (com.newrelic.agent.environment.EnvironmentService)14