Search in sources :

Example 11 with TransactionService

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

the class DistributedTracingApiTest method setup.

@Before
public void setup() throws Exception {
    serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    setupConfig(false);
    serviceManager.setTransactionService(new TransactionService());
    serviceManager.setAttributesService(new AttributesService());
    AgentBridge.agent = new AgentImpl(Agent.LOG);
    serviceManager.setRPMServiceManager(new MockRPMServiceManager());
    ServiceFactory.getServiceManager().start();
    DistributedTraceServiceImpl distributedTraceService = new DistributedTraceServiceImpl();
    ServiceFactory.getTransactionService().addTransactionListener(distributedTraceService);
    SpanEventsServiceImpl spanEventsService = SpanEventsServiceImpl.builder().agentConfig(agentConfig).build();
    serviceManager.setDistributedTraceService(distributedTraceService);
    serviceManager.setSpansEventService(spanEventsService);
    Map<String, Object> connectInfo = ImmutableMap.<String, Object>of(ACCOUNT_ID, "33", TRUSTED_ACCOUNT_KEY, "33", PRIMARY_APPLICATION_ID, "2827902");
    AgentConfig agentConfig = AgentHelper.createAgentConfig(true, Collections.<String, Object>emptyMap(), connectInfo);
    distributedTraceService.connected(null, agentConfig);
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) TransactionService(com.newrelic.agent.TransactionService) SpanEventsServiceImpl(com.newrelic.agent.service.analytics.SpanEventsServiceImpl) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) AgentImpl(com.newrelic.agent.AgentImpl) Before(org.junit.Before)

Example 12 with TransactionService

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

the class ServletUtilsTest method createServiceManager.

private static void createServiceManager(Map<String, Object> configMap) throws Exception {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.start();
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(configMap), configMap);
    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);
    AttributesService attService = new AttributesService();
    serviceManager.setAttributesService(attService);
    MockRPMServiceManager rpmServiceManager = new MockRPMServiceManager();
    serviceManager.setRPMServiceManager(rpmServiceManager);
}
Also used : ThreadService(com.newrelic.agent.ThreadService) SqlTraceService(com.newrelic.agent.sql.SqlTraceService) ConfigService(com.newrelic.agent.config.ConfigService) SqlTraceServiceImpl(com.newrelic.agent.sql.SqlTraceServiceImpl) 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) MockCoreService(com.newrelic.agent.MockCoreService) MockHarvestService(com.newrelic.agent.MockHarvestService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService)

Example 13 with TransactionService

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

the class KeyTransactionTraceSamplerTest 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);
    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 14 with TransactionService

use of com.newrelic.agent.TransactionService 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 15 with TransactionService

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

TransactionService (com.newrelic.agent.TransactionService)66 MockServiceManager (com.newrelic.agent.MockServiceManager)42 TransactionTraceService (com.newrelic.agent.trace.TransactionTraceService)39 ConfigService (com.newrelic.agent.config.ConfigService)38 MockRPMServiceManager (com.newrelic.agent.MockRPMServiceManager)30 ThreadService (com.newrelic.agent.ThreadService)30 HashMap (java.util.HashMap)29 HarvestService (com.newrelic.agent.HarvestService)26 MockRPMService (com.newrelic.agent.MockRPMService)26 Test (org.junit.Test)24 AttributesService (com.newrelic.agent.attributes.AttributesService)23 MockHarvestService (com.newrelic.agent.MockHarvestService)22 MockCoreService (com.newrelic.agent.MockCoreService)19 ErrorServiceImpl (com.newrelic.agent.errors.ErrorServiceImpl)19 AgentConfig (com.newrelic.agent.config.AgentConfig)17 StatsServiceImpl (com.newrelic.agent.stats.StatsServiceImpl)17 SqlTraceService (com.newrelic.agent.sql.SqlTraceService)16 SqlTraceServiceImpl (com.newrelic.agent.sql.SqlTraceServiceImpl)16 StatsService (com.newrelic.agent.stats.StatsService)15 Transaction (com.newrelic.agent.Transaction)13