Search in sources :

Example 1 with MockHarvestService

use of com.newrelic.agent.MockHarvestService 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)

Example 2 with MockHarvestService

use of com.newrelic.agent.MockHarvestService in project newrelic-java-agent by newrelic.

the class CacheServiceTest method createServiceManager.

private void createServiceManager(Map<String, Object> configMap) throws Exception {
    AgentConfig config = AgentConfigImpl.createAgentConfig(configMap);
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    ConfigService configService = ConfigServiceFactory.createConfigService(config, configMap);
    serviceManager.setConfigService(configService);
    CacheService cacheService = new CacheService();
    serviceManager.setCacheService(cacheService);
    HarvestService harvestService = new MockHarvestService();
    serviceManager.setHarvestService(harvestService);
    cacheService.start();
    serviceManager.start();
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) ConfigService(com.newrelic.agent.config.ConfigService) MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) MockServiceManager(com.newrelic.agent.MockServiceManager) MockHarvestService(com.newrelic.agent.MockHarvestService)

Example 3 with MockHarvestService

use of com.newrelic.agent.MockHarvestService in project newrelic-java-agent by newrelic.

the class ConfigServiceTest method createServiceManager.

private void createServiceManager(Map<String, Object> configMap) throws Exception {
    ConfigService configService = ConfigServiceFactory.createConfigServiceUsingSettings(configMap);
    MockServiceManager serviceManager = new MockServiceManager(configService);
    ServiceFactory.setServiceManager(serviceManager);
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
    MockRPMService rpmService = new MockRPMService();
    rpmService.setApplicationName("Unit Test");
    rpmServiceManager.setRPMService(rpmService);
    HarvestService harvestService = new MockHarvestService();
    serviceManager.setHarvestService(harvestService);
    configService.start();
    serviceManager.start();
}
Also used : MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) MockServiceManager(com.newrelic.agent.MockServiceManager) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) MockRPMService(com.newrelic.agent.MockRPMService)

Example 4 with MockHarvestService

use of com.newrelic.agent.MockHarvestService in project newrelic-java-agent by newrelic.

the class TransactionTraceServiceTest method createServiceManager.

private 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);
    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 5 with MockHarvestService

use of com.newrelic.agent.MockHarvestService in project newrelic-java-agent by newrelic.

the class TransactionEventsServiceTest method setup.

private void setup(boolean enabled, boolean isAttsEnabled, int size) throws Exception {
    MockServiceManager manager = new MockServiceManager();
    ServiceFactory.setServiceManager(manager);
    Map<String, Object> settings = new HashMap<>();
    settings.put("app_name", APP_NAME);
    Map<String, Object> events = new HashMap<>();
    settings.put("transaction_events", events);
    events.put("max_samples_stored", size);
    events.put("enabled", enabled);
    Map<String, Object> atts = new HashMap<>();
    settings.put("attributes", atts);
    atts.put("enabled", isAttsEnabled);
    Map<String, Object> distributedTracing = new HashMap<>();
    distributedTracing.put("enabled", true);
    settings.put("distributed_tracing", distributedTracing);
    Map<String, Object> spanConfig = new HashMap<>();
    spanConfig.put("collect_span_events", true);
    settings.put("span_events", spanConfig);
    iAgentConfig = AgentConfigImpl.createAgentConfig(settings);
    configService = ConfigServiceFactory.createConfigService(iAgentConfig, settings);
    manager.setConfigService(configService);
    TransactionTraceService transactionTraceService = new TransactionTraceService();
    manager.setTransactionTraceService(transactionTraceService);
    environmentService = new EnvironmentServiceImpl();
    manager.setEnvironmentService(environmentService);
    AttributesService attService = new AttributesService();
    manager.setAttributesService(attService);
    TransactionService transactionService = new TransactionService();
    manager.setTransactionService(transactionService);
    StatsService statsService = new StatsServiceImpl();
    manager.setStatsService(statsService);
    HarvestService harvestService = new MockHarvestService();
    manager.setHarvestService(harvestService);
    // manager.setTransactionEventsService(new TransactionEventsService(mockDistributedTraceIntrinsics));
    DistributedTraceServiceImpl distributedTraceService = new DistributedTraceServiceImpl();
    Map<String, Object> connectInfo = new HashMap<>();
    connectInfo.put(DistributedTracingConfig.ACCOUNT_ID, "1acct234");
    connectInfo.put(DistributedTracingConfig.TRUSTED_ACCOUNT_KEY, "67890");
    AgentConfig agentConfig = AgentHelper.createAgentConfig(true, Collections.<String, Object>emptyMap(), connectInfo);
    distributedTraceService.connected(null, agentConfig);
    manager.setDistributedTraceService(distributedTraceService);
    rpmServiceManager = new MockRPMServiceManager();
    rpmService = new MockRPMService();
    rpmService.setApplicationName(APP_NAME);
    rpmServiceManager.setRPMService(rpmService);
    ErrorServiceImpl errorService = new ErrorServiceImpl(APP_NAME);
    rpmService.setErrorService(errorService);
    rpmServiceAppName2 = (MockRPMService) rpmServiceManager.getOrCreateRPMService(APP_NAME_2);
    rpmServiceAppName2.setErrorService(new ErrorServiceImpl(APP_NAME_2));
    mockDistributedTraceIntrinsics = mock(TransactionDataToDistributedTraceIntrinsics.class);
    service = new TransactionEventsService(mockDistributedTraceIntrinsics);
    manager.setTransactionEventsService(service);
    manager.setRPMServiceManager(rpmServiceManager);
    service.addHarvestableToService(APP_NAME);
    service.doStart();
}
Also used : TransactionService(com.newrelic.agent.TransactionService) MockHarvestService(com.newrelic.agent.MockHarvestService) HarvestService(com.newrelic.agent.HarvestService) ErrorServiceImpl(com.newrelic.agent.errors.ErrorServiceImpl) HashMap(java.util.HashMap) StatsService(com.newrelic.agent.stats.StatsService) DistributedTraceServiceImpl(com.newrelic.agent.tracing.DistributedTraceServiceImpl) AttributesService(com.newrelic.agent.attributes.AttributesService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) AgentConfig(com.newrelic.agent.config.AgentConfig) EnvironmentServiceImpl(com.newrelic.agent.environment.EnvironmentServiceImpl) StatsServiceImpl(com.newrelic.agent.stats.StatsServiceImpl) MockServiceManager(com.newrelic.agent.MockServiceManager) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMService(com.newrelic.agent.MockRPMService)

Aggregations

MockHarvestService (com.newrelic.agent.MockHarvestService)39 MockRPMService (com.newrelic.agent.MockRPMService)30 MockServiceManager (com.newrelic.agent.MockServiceManager)26 MockRPMServiceManager (com.newrelic.agent.MockRPMServiceManager)25 HarvestService (com.newrelic.agent.HarvestService)24 ConfigService (com.newrelic.agent.config.ConfigService)23 TransactionService (com.newrelic.agent.TransactionService)22 TransactionTraceService (com.newrelic.agent.trace.TransactionTraceService)19 ThreadService (com.newrelic.agent.ThreadService)18 SqlTraceServiceImpl (com.newrelic.agent.sql.SqlTraceServiceImpl)16 MockCoreService (com.newrelic.agent.MockCoreService)15 SqlTraceService (com.newrelic.agent.sql.SqlTraceService)15 AttributesService (com.newrelic.agent.attributes.AttributesService)13 StatsEngineImpl (com.newrelic.agent.stats.StatsEngineImpl)13 ErrorServiceImpl (com.newrelic.agent.errors.ErrorServiceImpl)12 StatsServiceImpl (com.newrelic.agent.stats.StatsServiceImpl)12 OtherRootSqlTracer (com.newrelic.agent.tracers.OtherRootSqlTracer)12 SqlTracer (com.newrelic.agent.tracers.SqlTracer)12 Tracer (com.newrelic.agent.tracers.Tracer)12 BasicRequestRootTracer (com.newrelic.agent.tracers.servlet.BasicRequestRootTracer)12