Search in sources :

Example 1 with EnvironmentHolderSettingsGenerator

use of test.newrelic.EnvironmentHolderSettingsGenerator in project newrelic-java-agent by newrelic.

the class XmlRpcPointCutTest method externalTest.

@Test
public void externalTest() throws Exception {
    EnvironmentHolderSettingsGenerator envHolderSettings = new EnvironmentHolderSettingsGenerator(CONFIG_FILE, "all_enabled_test", CLASS_LOADER);
    EnvironmentHolder holder = new EnvironmentHolder(envHolderSettings);
    holder.setupEnvironment();
    try {
        doCall();
        SpanEventsService spanEventsService = ServiceFactory.getServiceManager().getSpanEventsService();
        String appName = ServiceFactory.getConfigService().getDefaultAgentConfig().getApplicationName();
        SamplingPriorityQueue<SpanEvent> spanEventsPool = spanEventsService.getOrCreateDistributedSamplingReservoir(appName);
        assertNotNull(spanEventsPool);
        List<SpanEvent> spanEvents = spanEventsPool.asList();
        assertNotNull(spanEvents);
        assertEquals(2, spanEvents.size());
        boolean java = false;
        boolean external = false;
        for (SpanEvent span : spanEvents) {
            String name = (String) span.getIntrinsics().get("name");
            if (name.equals("External/newrelic.com/XmlRpc/invoke")) {
                external = true;
                assertEquals("XmlRpc", span.getIntrinsics().get("component"));
                assertEquals("http", span.getIntrinsics().get("category"));
                assertEquals("http://newrelic.com", span.getAgentAttributes().get("http.url"));
            } else if (name.equals("Java/com.newrelic.agent.instrumentation.pointcuts.javax.xml.rpc.XmlRpcPointCutTest/doCall")) {
                java = true;
                assertEquals("generic", span.getIntrinsics().get("category"));
            }
        }
        assertTrue("Unexpected span events found", java && external);
    } finally {
        holder.close();
    }
}
Also used : EnvironmentHolderSettingsGenerator(test.newrelic.EnvironmentHolderSettingsGenerator) EnvironmentHolder(test.newrelic.test.agent.EnvironmentHolder) SpanEventsService(com.newrelic.agent.service.analytics.SpanEventsService) SpanEvent(com.newrelic.agent.model.SpanEvent) Test(org.junit.Test)

Example 2 with EnvironmentHolderSettingsGenerator

use of test.newrelic.EnvironmentHolderSettingsGenerator in project newrelic-java-agent by newrelic.

the class ExternalAsyncTest method setupEnvironmentHolder.

public EnvironmentHolder setupEnvironmentHolder(String environment) throws Exception {
    EnvironmentHolderSettingsGenerator envHolderSettings = new EnvironmentHolderSettingsGenerator(CONFIG_FILE, environment, CLASS_LOADER);
    EnvironmentHolder environmentHolder = new EnvironmentHolder(envHolderSettings);
    environmentHolder.setupEnvironment();
    return environmentHolder;
}
Also used : EnvironmentHolderSettingsGenerator(test.newrelic.EnvironmentHolderSettingsGenerator) EnvironmentHolder(test.newrelic.test.agent.EnvironmentHolder)

Example 3 with EnvironmentHolderSettingsGenerator

use of test.newrelic.EnvironmentHolderSettingsGenerator in project newrelic-java-agent by newrelic.

the class ApiTest method setupEnvironmentHolder.

public EnvironmentHolder setupEnvironmentHolder(String environment) throws Exception {
    EnvironmentHolderSettingsGenerator envHolderSettings = new EnvironmentHolderSettingsGenerator(CONFIG_FILE, environment, CLASS_LOADER);
    EnvironmentHolder environmentHolder = new EnvironmentHolder(envHolderSettings);
    environmentHolder.setupEnvironment();
    return environmentHolder;
}
Also used : EnvironmentHolderSettingsGenerator(test.newrelic.EnvironmentHolderSettingsGenerator) EnvironmentHolder(test.newrelic.test.agent.EnvironmentHolder)

Example 4 with EnvironmentHolderSettingsGenerator

use of test.newrelic.EnvironmentHolderSettingsGenerator in project newrelic-java-agent by newrelic.

the class SpanErrorsTest method before.

@Before
public void before() throws Exception {
    holder = new EnvironmentHolder(new EnvironmentHolderSettingsGenerator(CONFIG_FILE, "all_enabled_test", CLASS_LOADER));
    holder.setupEnvironment();
    APP_NAME = ServiceFactory.getConfigService().getDefaultAgentConfig().getApplicationName();
    ServiceFactory.getSpanEventService().getOrCreateDistributedSamplingReservoir(APP_NAME).clear();
}
Also used : EnvironmentHolderSettingsGenerator(test.newrelic.EnvironmentHolderSettingsGenerator) EnvironmentHolder(test.newrelic.test.agent.EnvironmentHolder) Before(org.junit.Before)

Example 5 with EnvironmentHolderSettingsGenerator

use of test.newrelic.EnvironmentHolderSettingsGenerator in project newrelic-java-agent by newrelic.

the class SpanIdOnErrorsTest method before.

@Before
public void before() throws Exception {
    holder = new EnvironmentHolder(new EnvironmentHolderSettingsGenerator(CONFIG_FILE, "all_enabled_test", CLASS_LOADER));
    holder.setupEnvironment();
    APP_NAME = ServiceFactory.getConfigService().getDefaultAgentConfig().getApplicationName();
    cleanup();
}
Also used : EnvironmentHolderSettingsGenerator(test.newrelic.EnvironmentHolderSettingsGenerator) EnvironmentHolder(test.newrelic.test.agent.EnvironmentHolder) Before(org.junit.Before)

Aggregations

EnvironmentHolderSettingsGenerator (test.newrelic.EnvironmentHolderSettingsGenerator)14 EnvironmentHolder (test.newrelic.test.agent.EnvironmentHolder)10 Before (org.junit.Before)4 Test (org.junit.Test)2 TransactionData (com.newrelic.agent.TransactionData)1 TransactionListener (com.newrelic.agent.TransactionListener)1 SpanEvent (com.newrelic.agent.model.SpanEvent)1 SpanEventsService (com.newrelic.agent.service.analytics.SpanEventsService)1 Stats (com.newrelic.agent.stats.Stats)1 StatsEngine (com.newrelic.agent.stats.StatsEngine)1 TransactionStats (com.newrelic.agent.stats.TransactionStats)1 Tracer (com.newrelic.agent.tracers.Tracer)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 CountDownLatch (java.util.concurrent.CountDownLatch)1