Search in sources :

Example 1 with AgentImpl

use of com.newrelic.agent.AgentImpl 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 2 with AgentImpl

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

the class CircuitBreakerServiceTest method setup.

@BeforeClass
public static void setup() {
    MockServiceManager serviceManager = new MockServiceManager();
    ServiceFactory.setServiceManager(serviceManager);
    try {
        serviceManager.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    AgentBridge.instrumentation = new InstrumentationImpl(Agent.LOG);
    AgentBridge.agent = new AgentImpl(Agent.LOG);
}
Also used : InstrumentationImpl(com.newrelic.agent.instrumentation.InstrumentationImpl) MockServiceManager(com.newrelic.agent.MockServiceManager) AgentImpl(com.newrelic.agent.AgentImpl) BeforeClass(org.junit.BeforeClass)

Aggregations

AgentImpl (com.newrelic.agent.AgentImpl)2 MockServiceManager (com.newrelic.agent.MockServiceManager)2 MockRPMServiceManager (com.newrelic.agent.MockRPMServiceManager)1 TransactionService (com.newrelic.agent.TransactionService)1 AttributesService (com.newrelic.agent.attributes.AttributesService)1 AgentConfig (com.newrelic.agent.config.AgentConfig)1 InstrumentationImpl (com.newrelic.agent.instrumentation.InstrumentationImpl)1 SpanEventsServiceImpl (com.newrelic.agent.service.analytics.SpanEventsServiceImpl)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1