use of com.newrelic.agent.MockRPMServiceManager 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);
}
use of com.newrelic.agent.MockRPMServiceManager 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);
}
use of com.newrelic.agent.MockRPMServiceManager in project newrelic-java-agent by newrelic.
the class SlowQueryInfoTest method setupServiceManager.
private void setupServiceManager(Map<String, Object> settings) {
MockServiceManager serviceManager = new MockServiceManager();
settings.put("app_name", "Unit Test");
serviceManager.setConfigService(ConfigServiceFactory.createConfigServiceUsingSettings(settings));
serviceManager.setTransactionTraceService(Mockito.mock(TransactionTraceService.class));
serviceManager.setTransactionService(Mockito.mock(TransactionService.class));
serviceManager.setTransactionEventsService(Mockito.mock(TransactionEventsService.class));
serviceManager.setHarvestService(Mockito.mock(HarvestService.class));
ServiceFactory.setServiceManager(serviceManager);
serviceManager.setDistributedTraceService(new DistributedTraceServiceImpl());
serviceManager.setAttributesService(new AttributesService());
serviceManager.setRPMServiceManager(new MockRPMServiceManager());
}
use of com.newrelic.agent.MockRPMServiceManager 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();
}
use of com.newrelic.agent.MockRPMServiceManager in project newrelic-java-agent by newrelic.
the class NormalizedTransactionTrace method setUrlRules.
private String setUrlRules(JSONArray rules) {
MockRPMServiceManager rpmServiceManager = (MockRPMServiceManager) ServiceFactory.getRPMServiceManager();
List<ConnectionListener> connectionListeners = rpmServiceManager.getConnectionListeners();
ConnectionListener connectionListener = connectionListeners.get(0);
MockRPMService rpmService = (MockRPMService) rpmServiceManager.getRPMService();
String appName = rpmService.getApplicationName();
Map<String, Object> data = new HashMap<>();
data.put(NormalizationRuleConfig.METRIC_NAME_RULES_KEY, rules);
connectionListener.connected(rpmService, AgentConfigImpl.createAgentConfig(data));
return appName;
}
Aggregations