Search in sources :

Example 56 with ConfigService

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

the class TransactionEventTest method setup.

@Before
public void setup() {
    MockServiceManager manager = new MockServiceManager();
    ServiceFactory.setServiceManager(manager);
    Map<String, Object> map = createConfigMap();
    ConfigService configService = ConfigServiceFactory.createConfigService(AgentConfigImpl.createAgentConfig(map), map);
    manager.setConfigService(configService);
    manager.setStatsService(Mockito.mock(StatsService.class));
    AttributesService attService = new AttributesService();
    manager.setAttributesService(attService);
    startTime = System.currentTimeMillis();
}
Also used : ConfigService(com.newrelic.agent.config.ConfigService) StatsService(com.newrelic.agent.stats.StatsService) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) JSONObject(org.json.simple.JSONObject) Before(org.junit.Before)

Example 57 with ConfigService

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

the class ProfileTest method turnOnSimpleCompression.

private void turnOnSimpleCompression() {
    Map<String, Object> map = ImmutableMap.<String, Object>of(AgentConfigImpl.SIMPLE_COMPRESSION_PROPERTY, true);
    AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(map);
    ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, map);
    serviceManager.setConfigService(configService);
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) ConfigService(com.newrelic.agent.config.ConfigService)

Example 58 with ConfigService

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

the class RPMConnectionServiceTest method syncStartup.

@Test
public void syncStartup() throws Exception {
    Map<String, Object> map = new HashMap<>();
    map.put(AgentConfigImpl.APP_NAME, "MyApplication");
    map.put(AgentConfigImpl.SYNC_STARTUP, true);
    AgentConfig agentConfig = AgentConfigImpl.createAgentConfig(map);
    MockServiceManager serviceManager = (MockServiceManager) ServiceFactory.getServiceManager();
    ConfigService configService = ConfigServiceFactory.createConfigService(agentConfig, map);
    serviceManager.setConfigService(configService);
    CountDownLatch latch = new CountDownLatch(1);
    MockRPMService rpmService = new MockRPMService(latch);
    rpmService.setApplicationName("MyApplication");
    rpmConnectionService.connect(rpmService);
    Assert.assertEquals(0, latch.getCount());
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) ConfigService(com.newrelic.agent.config.ConfigService) HashMap(java.util.HashMap) MockServiceManager(com.newrelic.agent.MockServiceManager) CountDownLatch(java.util.concurrent.CountDownLatch) MockRPMService(com.newrelic.agent.MockRPMService) Test(org.junit.Test) AgentConfigFactoryTest(com.newrelic.agent.config.AgentConfigFactoryTest)

Example 59 with ConfigService

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

the class RPMConnectionServiceTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    AgentHelper.initializeConfig();
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    serviceManager.start();
    Map<String, Object> settings = AgentConfigFactoryTest.createStagingMap();
    AgentConfig config = AgentConfigFactory.createAgentConfig(settings, null, null);
    Environment env = new Environment(config, "c:\\test\\log");
    EnvironmentService envService = Mockito.mock(EnvironmentService.class, new Returns(env));
    serviceManager.setEnvironmentService(envService);
    ConfigService configService = ConfigServiceFactory.createConfigServiceUsingSettings(settings);
    serviceManager.setConfigService(configService);
    ThreadService threadService = new ThreadService();
    serviceManager.setThreadService(threadService);
    rpmConnectionService = new TestRPMConnectionService();
}
Also used : AgentConfig(com.newrelic.agent.config.AgentConfig) Returns(org.mockito.internal.stubbing.answers.Returns) ThreadService(com.newrelic.agent.ThreadService) ConfigService(com.newrelic.agent.config.ConfigService) MockServiceManager(com.newrelic.agent.MockServiceManager) Environment(com.newrelic.agent.environment.Environment) EnvironmentService(com.newrelic.agent.environment.EnvironmentService) BeforeClass(org.junit.BeforeClass)

Example 60 with ConfigService

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

the class KeyTransactionProfileTest 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);
}
Also used : ThreadService(com.newrelic.agent.ThreadService) AgentConfig(com.newrelic.agent.config.AgentConfig) ConfigService(com.newrelic.agent.config.ConfigService) HashMap(java.util.HashMap) MockServiceManager(com.newrelic.agent.MockServiceManager) BeforeClass(org.junit.BeforeClass)

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