Search in sources :

Example 91 with ConfigService

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

the class StatsEngineTest method createServiceManager.

/**
 * Creates the service manager.
 *
 * @param map The configuration for the mananger.
 * @throws Exception Thrown if a problem creating the service manager.
 */
private static void createServiceManager(Map<String, Object> map) throws Exception {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.start();
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(map), map);
    serviceManager.setConfigService(configService);
    MockCoreService agent = new MockCoreService();
    serviceManager.setCoreService(agent);
    HarvestService harvestService = new MockHarvestService();
    serviceManager.setHarvestService(harvestService);
    TransactionService transactionService = new TransactionService();
    serviceManager.setTransactionService(transactionService);
    TransactionTraceService transactionTraceService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(transactionTraceService);
    SqlTraceService sqlTraceService = new SqlTraceServiceImpl();
    serviceManager.setSqlTraceService(sqlTraceService);
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    MockRPMService rpmService = new MockRPMService();
    rpmService.setApplicationName(APP_NAME);
    rpmService.setErrorService(new ErrorServiceImpl(APP_NAME));
    rpmServiceManager.setRPMService(rpmService);
    configService.start();
    serviceManager.setNormalizationService(new NormalizationServiceImpl());
    StatsService statsService = new StatsServiceImpl();
    serviceManager.setStatsService(statsService);
    statsService.start();
}
Also used : SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) TransactionService(com.newrelic.agent.TransactionService) ErrorServiceImpl(com.newrelic.agent.errors.ErrorServiceImpl) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) ThreadService(com.newrelic.agent.ThreadService) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) ConfigService(com.newrelic.agent.config.ConfigService) MockServiceManager(com.newrelic.agent.MockServiceManager) MockCoreService(com.newrelic.agent.MockCoreService) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMService(com.newrelic.agent.MockRPMService) NormalizationServiceImpl(com.newrelic.agent.normalization.NormalizationServiceImpl)

Example 92 with ConfigService

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

the class SyntheticsTransactionSamplerTest method createServiceManager.

private static void createServiceManager(Map<String, Object> configMap) throws Exception {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(configMap), configMap);
    serviceManager.setConfigService(configService);
    DatabaseService dbService = new DatabaseService();
    serviceManager.setDatabaseService(dbService);
    HarvestService harvestService = new MockHarvestService();
    serviceManager.setHarvestService(harvestService);
    TransactionService transactionService = new TransactionService();
    serviceManager.setTransactionService(transactionService);
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    MockRPMService rpmService = new MockRPMService();
    rpmService.setApplicationName(APP_NAME);
    rpmService.setIsConnected(true);
    rpmServiceManager.setRPMService(rpmService);
    CommandParser commandParser = new CommandParser();
    serviceManager.setCommandParser(commandParser);
    AttributesService attService = new AttributesService();
    serviceManager.setAttributesService(attService);
    TransactionTraceService ttService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(ttService);
    ttService.start();
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) TransactionService(com.newrelic.agent.TransactionService) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) DatabaseService(com.newrelic.agent.database.DatabaseService) MockRPMService(com.newrelic.agent.MockRPMService) CommandParser(com.newrelic.agent.commands.CommandParser)

Example 93 with ConfigService

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

the class TransactionSegmentTest method setupServiceManager.

private MockServiceManager setupServiceManager(Map<String, Object> transactionSegmentsConfig) {
    final Map<String, Object> config = new HashMap<>();
    config.put(AgentConfigImpl.APP_NAME, "name");
    config.put(AgentConfigImpl.TRANSACTION_SEGMENTS, transactionSegmentsConfig);
    MockServiceManager manager = new MockServiceManager();
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(config), config);
    manager.setConfigService(configService);
    manager.setAttributesService(new AttributesService());
    ServiceFactory.setServiceManager(manager);
    return manager;
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) HashMap(java.util.HashMap) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService)

Example 94 with ConfigService

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

the class DistributedTracingApiTest method setupConfig.

private void setupConfig(boolean excludeNRHeader) {
    Map<String, Object> dtConfig = ImmutableMap.<String, Object>of("enabled", true, "exclude_newrelic_header", excludeNRHeader);
    Map<String, Object> spanConfig = ImmutableMap.of("collect_span_events", (Object) true);
    Map<String, Object> config = ImmutableMap.of(APP_NAME, "test", "distributed_tracing", dtConfig, "span_events", spanConfig);
    agentConfig = AgentConfigImpl.createAgentConfig(config);
    ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, Collections.<String, Object>emptyMap());
    serviceManager.setConfigService(configService);
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService)

Example 95 with ConfigService

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

the class SpanProxyTest method before.

@Before
public void before() throws Exception {
    Map<String, Object> config = new HashMap<>();
    config.put(AgentConfigImpl.APP_NAME, "Test");
    Map<String, Object> dtConfig = new HashMap<>();
    dtConfig.put("enabled", true);
    config.put("distributed_tracing", dtConfig);
    Map<String, Object> spanConfig = new HashMap<>();
    spanConfig.put("collect_span_events", true);
    config.put("span_events", spanConfig);
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(config), Collections.<String, Object>emptyMap());
    MockServiceManager serviceManager = new MockServiceManager(configService);
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.setConfigService(configService);
    ServiceFactory.getServiceManager().start();
    serviceManager.setDistributedTraceService(new MockDistributedTraceService());
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) HashMap(java.util.HashMap) MockServiceManager(com.newrelic.agent.MockServiceManager) MockDistributedTraceService(com.newrelic.agent.util.MockDistributedTraceService) Before(org.junit.Before)

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