Search in sources :

Example 1 with MockServiceManager

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

the class AgentAttributeSenderTest method setup.

@Before
public void setup() {
    try {
        manager = new MockServiceManager();
        ServiceFactory.setServiceManager(manager);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : MockServiceManager(com.newrelic.agent.MockServiceManager) Before(org.junit.Before)

Example 2 with MockServiceManager

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

the class AttributeValidatorTest method beforeClass.

@BeforeClass
public static void beforeClass() {
    MockServiceManager sm = new MockServiceManager();
    ServiceFactory.setServiceManager(sm);
}
Also used : MockServiceManager(com.newrelic.agent.MockServiceManager) BeforeClass(org.junit.BeforeClass)

Example 3 with MockServiceManager

use of com.newrelic.agent.MockServiceManager 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 4 with MockServiceManager

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

the class BrowserConfigTest method setupManager.

public void setupManager(boolean captureParams, boolean setSslForHttpToTrue) {
    MockServiceManager manager = new MockServiceManager();
    ServiceFactory.setServiceManager(manager);
    Map<String, Object> params = new HashMap<>();
    if (captureParams || setSslForHttpToTrue) {
        Map<String, Object> bProps = new HashMap<>();
        params.put("browser_monitoring", bProps);
        if (captureParams) {
            Map<String, Object> baProps = new HashMap<>();
            bProps.put("attributes", baProps);
            baProps.put("enabled", Boolean.TRUE);
        }
        if (setSslForHttpToTrue) {
            bProps.put("ssl_for_http", Boolean.TRUE);
        }
    }
    params.put("license_key", LICENSE_KEY);
    ImmutableMap<String, Object> distributedTracingSettings = ImmutableMap.<String, Object>builder().put(DistributedTracingConfig.ENABLED, Boolean.FALSE).build();
    params.put(AgentConfigImpl.DISTRIBUTED_TRACING, distributedTracingSettings);
    manager.setConfigService(ConfigServiceFactory.createConfigServiceUsingSettings(params));
    manager.setTransactionService(new TransactionService());
    manager.setTransactionTraceService(new TransactionTraceService());
    MockRPMServiceManager rpmServiceMgr = new MockRPMServiceManager();
    MockRPMService rpmService = new MockRPMService();
    rpmService.setApplicationName(APP_NAME);
    rpmService.setEverConnected(true);
    rpmService.setErrorService(new ErrorServiceImpl(APP_NAME));
    rpmServiceMgr.setRPMService(rpmService);
    manager.setRPMServiceManager(rpmServiceMgr);
    AttributesService attService = new AttributesService();
    manager.setAttributesService(attService);
    ServiceFactory.setServiceManager(manager);
    Transaction.clearTransaction();
}
Also used : TransactionService(com.newrelic.agent.TransactionService) ErrorServiceImpl(com.newrelic.agent.errors.ErrorServiceImpl) HashMap(java.util.HashMap) MockServiceManager(com.newrelic.agent.MockServiceManager) AttributesService(com.newrelic.agent.attributes.AttributesService) MockRPMServiceManager(com.newrelic.agent.MockRPMServiceManager) TransactionTraceService(com.newrelic.agent.trace.TransactionTraceService) MockRPMService(com.newrelic.agent.MockRPMService)

Example 5 with MockServiceManager

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

the class BrowserTransactionStateTest method setup.

@Before
public void setup() {
    MockServiceManager serviceManager = new MockServiceManager();
    serviceManager.setConfigService(new MockConfigService(AgentConfigFactory.createAgentConfig(Collections.<String, Object>emptyMap(), Collections.<String, Object>emptyMap(), null)));
    ServiceFactory.setServiceManager(serviceManager);
    MockitoAnnotations.initMocks(this);
}
Also used : MockServiceManager(com.newrelic.agent.MockServiceManager) MockConfigService(com.newrelic.agent.MockConfigService) Before(org.junit.Before)

Aggregations

MockServiceManager (com.newrelic.agent.MockServiceManager)127 ConfigService (com.newrelic.agent.config.ConfigService)61 Test (org.junit.Test)49 MockRPMServiceManager (com.newrelic.agent.MockRPMServiceManager)48 HashMap (java.util.HashMap)44 TransactionService (com.newrelic.agent.TransactionService)42 MockRPMService (com.newrelic.agent.MockRPMService)37 ThreadService (com.newrelic.agent.ThreadService)34 AgentConfig (com.newrelic.agent.config.AgentConfig)34 AttributesService (com.newrelic.agent.attributes.AttributesService)28 HarvestService (com.newrelic.agent.HarvestService)27 TransactionTraceService (com.newrelic.agent.trace.TransactionTraceService)27 MockHarvestService (com.newrelic.agent.MockHarvestService)26 MockCoreService (com.newrelic.agent.MockCoreService)21 StatsService (com.newrelic.agent.stats.StatsService)21 StatsServiceImpl (com.newrelic.agent.stats.StatsServiceImpl)21 Before (org.junit.Before)19 ErrorServiceImpl (com.newrelic.agent.errors.ErrorServiceImpl)16 SqlTraceServiceImpl (com.newrelic.agent.sql.SqlTraceServiceImpl)16 SqlTraceService (com.newrelic.agent.sql.SqlTraceService)15