use of com.newrelic.agent.MockServiceManager 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();
}
use of com.newrelic.agent.MockServiceManager in project newrelic-java-agent by newrelic.
the class CommandParserTest method createServiceManager.
private MockServiceManager createServiceManager(Map<String, Object> config) throws Exception {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
ThreadService threadService = new ThreadService();
serviceManager.setThreadService(threadService);
ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(config), config);
serviceManager.setConfigService(configService);
TransactionService transactionService = new TransactionService();
serviceManager.setTransactionService(transactionService);
TransactionTraceService transactionTraceService = new TransactionTraceService();
serviceManager.setTransactionTraceService(transactionTraceService);
RPMConnectionService rpmConnectionService = new RPMConnectionServiceImpl();
serviceManager.setRPMConnectionService(rpmConnectionService);
ProfilerService profilerService = new ProfilerService();
serviceManager.setProfilerService(profilerService);
EnvironmentService envService = new EnvironmentServiceImpl();
serviceManager.setEnvironmentService(envService);
HarvestService harvestService = new HarvestServiceImpl();
serviceManager.setHarvestService(harvestService);
return serviceManager;
}
use of com.newrelic.agent.MockServiceManager in project newrelic-java-agent by newrelic.
the class CommandParserThreadProfilerTest method createServiceManager.
private MockServiceManager createServiceManager(Map<String, Object> config) throws Exception {
MockServiceManager serviceManager = new MockServiceManager();
ServiceFactory.setServiceManager(serviceManager);
ThreadService threadService = new ThreadService();
serviceManager.setThreadService(threadService);
ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(config), config);
serviceManager.setConfigService(configService);
TransactionService transactionService = new TransactionService();
serviceManager.setTransactionService(transactionService);
TransactionTraceService transactionTraceService = new TransactionTraceService();
serviceManager.setTransactionTraceService(transactionTraceService);
RPMConnectionService rpmConnectionService = new RPMConnectionServiceImpl();
serviceManager.setRPMConnectionService(rpmConnectionService);
ProfilerService profilerService = new ProfilerService();
serviceManager.setProfilerService(profilerService);
EnvironmentService envService = new EnvironmentServiceImpl();
serviceManager.setEnvironmentService(envService);
HarvestService harvestService = new HarvestServiceImpl();
serviceManager.setHarvestService(harvestService);
return serviceManager;
}
use of com.newrelic.agent.MockServiceManager in project newrelic-java-agent by newrelic.
the class ClassTransformerConfigImplTest method testPointcutGroupDisabled.
@Test
public void testPointcutGroupDisabled() {
Map<String, Object> configuration = new HashMap<>();
configuration.put("class_transformer:my_pointcut_group:enabled", true);
configuration.put("class_transformer:instrumentation_default:enabled", false);
configuration.put("app_name", "Unit Test");
configuration = buildConfigMap(configuration);
AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(configuration);
ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, Collections.<String, Object>emptyMap());
ServiceManager serviceManager = new MockServiceManager(configService);
ServiceFactory.setServiceManager(serviceManager);
PointCutConfiguration pointCutConfiguration = new PointCutConfiguration("PointcutClassName", "my_pointcut_group", true, agentConfig.getClassTransformerConfig());
assertTrue(pointCutConfiguration.isEnabled());
}
use of com.newrelic.agent.MockServiceManager in project newrelic-java-agent by newrelic.
the class ClassTransformerConfigImplTest method testSpringPointcutEnabledDefaultDisabled.
@Test
public void testSpringPointcutEnabledDefaultDisabled() {
Map<String, Object> configuration = new HashMap<>();
configuration.put("class_transformer:instrumentation_default:enabled", false);
configuration.put("enable_spring_tracing", true);
configuration.put("app_name", "Unit Test");
configuration = buildConfigMap(configuration);
AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(configuration);
ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, Collections.<String, Object>emptyMap());
ServiceManager serviceManager = new MockServiceManager(configService);
ServiceFactory.setServiceManager(serviceManager);
SpringPointCut springPointCut = new SpringPointCut(null, agentConfig);
assertTrue(springPointCut.isEnabled());
}
Aggregations