Search in sources :

Example 1 with ConfigService

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

the class RPMServiceManagerTest method createServiceManager.

private 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);
    RPMServiceManager rpmServiceManager = new RPMServiceManagerImpl() {

        @Override
        protected IRPMService createRPMService(List<String> appNames, ConnectionConfigListener connectionConfigListener, ConnectionListener connectionListener) {
            MockRPMService rpmService = new MockRPMService();
            rpmService.setApplicationNames(appNames);
            rpmService.setConnectionConfigListener(connectionConfigListener);
            rpmService.setConnectionListener(connectionListener);
            return rpmService;
        }
    };
    serviceManager.setRPMServiceManager(rpmServiceManager);
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) List(java.util.List)

Example 2 with ConfigService

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

the class RPMServiceTest method createServiceManager.

private void createServiceManager(AgentConfig config, Map<String, Object> localSettings) {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    ConfigService configService = ConfigServiceFactory.createConfigService(config, localSettings);
    serviceManager.setConfigService(configService);
    HarvestService harvestService = new MockHarvestService();
    serviceManager.setHarvestService(harvestService);
    TransactionService transactionService = new TransactionService();
    serviceManager.setTransactionService(transactionService);
    TransactionTraceService transactionTraceService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(transactionTraceService);
    DatabaseService dbService = new DatabaseService();
    serviceManager.setDatabaseService(dbService);
    SqlTraceService sqlTraceService = new SqlTraceServiceImpl();
    serviceManager.setSqlTraceService(sqlTraceService);
    RPMConnectionService rpmConnectionService = new RPMConnectionServiceImpl();
    serviceManager.setRPMConnectionService(rpmConnectionService);
    ProfilerService profilerService = new ProfilerService();
    serviceManager.setProfilerService(profilerService);
    StatsService statsService = new StatsServiceImpl();
    serviceManager.setStatsService(statsService);
    EnvironmentService envService = new EnvironmentServiceImpl();
    serviceManager.setEnvironmentService(envService);
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    AttributesService attService = new AttributesService();
    serviceManager.setAttributesService(attService);
    UtilizationService utilService = new UtilizationService();
    serviceManager.setUtilizationService(utilService);
    TransactionDataToDistributedTraceIntrinsics transactionDataToDistributedTraceIntrinsics = mock(TransactionDataToDistributedTraceIntrinsics.class);
    when(transactionDataToDistributedTraceIntrinsics.buildDistributedTracingIntrinsics(any(TransactionData.class), anyBoolean())).thenReturn(Collections.<String, Object>emptyMap());
    TransactionEventsService transactionEventsService = new TransactionEventsService(transactionDataToDistributedTraceIntrinsics);
    serviceManager.setTransactionEventsService(transactionEventsService);
    serviceManager.setSpansEventService(mock(SpanEventsServiceImpl.class));
}
Also used : SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) UtilizationService(com.newrelic.agent.utilization.UtilizationService) RPMConnectionService(com.newrelic.agent.rpm.RPMConnectionService) StatsService(com.newrelic.agent.stats.StatsService) AttributesService(com.newrelic.agent.attributes.AttributesService) DatabaseService(com.newrelic.agent.database.DatabaseService) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) TransactionDataToDistributedTraceIntrinsics(com.newrelic.agent.service.analytics.TransactionDataToDistributedTraceIntrinsics) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) ConfigService(com.newrelic.agent.config.ConfigService) RPMConnectionServiceImpl(com.newrelic.agent.rpm.RPMConnectionServiceImpl) SpanEventsServiceImpl(com.newrelic.agent.service.analytics.SpanEventsServiceImpl) EnvironmentServiceImpl(com.newrelic.agent.environment.EnvironmentServiceImpl) StatsServiceImpl(com.newrelic.agent.stats.StatsServiceImpl) TransactionEventsService(com.newrelic.agent.service.analytics.TransactionEventsService) EnvironmentService(com.newrelic.agent.environment.EnvironmentService) ProfilerService(com.newrelic.agent.profile.ProfilerService)

Example 3 with ConfigService

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

the class SegmentTest method createServiceManager.

private static void createServiceManager(Map<String, Object> map, ExpirationService expirationService) throws Exception {
    ConfigService configService = ConfigServiceFactory.createConfigServiceUsingSettings(map);
    MockServiceManager serviceManager = new MockServiceManager(configService);
    ServiceFactory.setServiceManager(serviceManager);
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    serviceManager.setConfigService(configService);
    StatsService statsService = new StatsServiceImpl();
    serviceManager.setStatsService(statsService);
    MockCoreService agent = new MockCoreService();
    serviceManager.setCoreService(agent);
    HarvestService harvestService = new MockHarvestService();
    serviceManager.setHarvestService(harvestService);
    AsyncTransactionService asyncTxService = new AsyncTransactionService();
    serviceManager.setAsyncTransactionService(asyncTxService);
    TransactionService transactionService = new TransactionService(2, 1, 3, TimeUnit.SECONDS);
    serviceManager.setTransactionService(transactionService);
    EnvironmentService envService = new EnvironmentServiceImpl();
    serviceManager.setEnvironmentService(envService);
    TransactionTraceService transactionTraceService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(transactionTraceService);
    SqlTraceService sqlTraceService = new SqlTraceServiceImpl();
    serviceManager.setSqlTraceService(sqlTraceService);
    serviceManager.setAttributesService(new AttributesService());
    DistributedTraceServiceImpl distributedTraceService = new DistributedTraceServiceImpl();
    Map<String, Object> configMap = ImmutableMap.<String, Object>builder().put("cross_application_tracer", ImmutableMap.builder().put("account_id", "12abc345").put("trusted_account_key", "12abc345").build()).build();
    distributedTraceService.connected(null, AgentConfigFactory.createAgentConfig(configMap, null, null));
    serviceManager.setDistributedTraceService(distributedTraceService);
    TransactionDataToDistributedTraceIntrinsics transactionDataToDistributedTraceIntrinsics = new TransactionDataToDistributedTraceIntrinsics(distributedTraceService);
    serviceManager.setTransactionEventsService(new TransactionEventsService(transactionDataToDistributedTraceIntrinsics));
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    serviceManager.setExpirationService(expirationService);
    SpanEventsService spanEventsService = SpanEventsServiceFactory.builder().configService(configService).reservoirManager(new MockSpanEventReservoirManager(configService)).transactionService(serviceManager.getTransactionService()).rpmServiceManager(serviceManager.getRPMServiceManager()).spanEventCreationDecider(new SpanEventCreationDecider(configService)).environmentService(envService).transactionDataToDistributedTraceIntrinsics(transactionDataToDistributedTraceIntrinsics).build();
    serviceManager.setSpansEventService(spanEventsService);
    serviceManager.start();
}
Also used : StatsService(com.newrelic.agent.stats.StatsService) TransactionDataToDistributedTraceIntrinsics(com.newrelic.agent.service.analytics.TransactionDataToDistributedTraceIntrinsics) SpanEventCreationDecider(com.newrelic.agent.service.analytics.SpanEventCreationDecider) StatsServiceImpl(com.newrelic.agent.stats.StatsServiceImpl) SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) AsyncTransactionService(com.newrelic.agent.service.async.AsyncTransactionService) DistributedTraceServiceImpl(com.newrelic.agent.tracing.DistributedTraceServiceImpl) AttributesService(com.newrelic.agent.attributes.AttributesService) SpanEventsService(com.newrelic.agent.service.analytics.SpanEventsService) AsyncTransactionService(com.newrelic.agent.service.async.AsyncTransactionService) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) ConfigService(com.newrelic.agent.config.ConfigService) EnvironmentServiceImpl(com.newrelic.agent.environment.EnvironmentServiceImpl) TransactionEventsService(com.newrelic.agent.service.analytics.TransactionEventsService) EnvironmentService(com.newrelic.agent.environment.EnvironmentService)

Example 4 with ConfigService

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

the class TransactionAsyncUtility method createServiceManager.

public static void createServiceManager(Map<String, Object> map) throws Exception {
    ConfigService configService = ConfigServiceFactory.createConfigServiceUsingSettings(map);
    MockServiceManager serviceManager = new MockServiceManager(configService);
    ServiceFactory.setServiceManager(serviceManager);
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    MockCoreService agent = new MockCoreService();
    serviceManager.setCoreService(agent);
    HarvestService harvestService = new MockHarvestService();
    serviceManager.setHarvestService(harvestService);
    EnvironmentService envService = new EnvironmentServiceImpl();
    serviceManager.setEnvironmentService(envService);
    AsyncTransactionService asyncTxService = new AsyncTransactionService();
    serviceManager.setAsyncTransactionService(asyncTxService);
    serviceManager.setStatsService(new StatsServiceImpl());
    TransactionService transactionService = new TransactionService();
    serviceManager.setTransactionService(transactionService);
    TransactionTraceService transactionTraceService = new TransactionTraceService();
    serviceManager.setTransactionTraceService(transactionTraceService);
    SqlTraceService sqlTraceService = new SqlTraceServiceImpl();
    serviceManager.setSqlTraceService(sqlTraceService);
    serviceManager.setAttributesService(new AttributesService());
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    DistributedTraceServiceImpl distributedTraceService = new DistributedTraceServiceImpl();
    serviceManager.setDistributedTraceService(distributedTraceService);
    TransactionDataToDistributedTraceIntrinsics transactionDataToDistributedTraceIntrinsics = new TransactionDataToDistributedTraceIntrinsics(distributedTraceService);
    serviceManager.setTransactionEventsService(new TransactionEventsService(transactionDataToDistributedTraceIntrinsics));
    serviceManager.setExpirationService(new ExpirationService());
    serviceManager.start();
}
Also used : SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) AsyncTransactionService(com.newrelic.agent.service.async.AsyncTransactionService) DistributedTraceServiceImpl(com.newrelic.agent.tracing.DistributedTraceServiceImpl) AttributesService(com.newrelic.agent.attributes.AttributesService) AsyncTransactionService(com.newrelic.agent.service.async.AsyncTransactionService) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) TransactionDataToDistributedTraceIntrinsics(com.newrelic.agent.service.analytics.TransactionDataToDistributedTraceIntrinsics) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) ConfigService(com.newrelic.agent.config.ConfigService) EnvironmentServiceImpl(com.newrelic.agent.environment.EnvironmentServiceImpl) StatsServiceImpl(com.newrelic.agent.stats.StatsServiceImpl) TransactionEventsService(com.newrelic.agent.service.analytics.TransactionEventsService) EnvironmentService(com.newrelic.agent.environment.EnvironmentService)

Example 5 with ConfigService

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

the class RequestUriConfigTests method createServiceManager.

private void createServiceManager(Map<String, Object> configMap) throws Exception {
    ConfigService configService = ConfigServiceFactory.createConfigServiceUsingSettings(configMap);
    MockServiceManager serviceManager = new MockServiceManager(configService);
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.setHarvestService(new MockHarvestService());
    serviceManager.setSqlTraceService(new SqlTraceServiceImpl());
    serviceManager.setAttributesService(new AttributesService());
    serviceManager.setNormalizationService(new NormalizationServiceImpl());
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    MockRPMService rpmService = new MockRPMService();
    rpmService.setApplicationName(serviceManager.getConfigService().getDefaultAgentConfig().getApplicationName());
    rpmService.setEverConnected(true);
    rpmService.setIsConnected(true);
    rpmService.setErrorService(new ErrorServiceImpl(serviceManager.getConfigService().getDefaultAgentConfig().getApplicationName()));
    rpmServiceManager.setRPMService(rpmService);
    serviceManager.start();
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) ErrorServiceImpl(com.newrelic.agent.errors.ErrorServiceImpl) MockServiceManager(com.newrelic.agent.MockServiceManager) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) MockRPMService(com.newrelic.agent.MockRPMService) NormalizationServiceImpl(com.newrelic.agent.normalization.NormalizationServiceImpl)

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