Search in sources :

Example 66 with TransactionDataList

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

the class TraceAccessorApiTest method testAcceptPayloadGetSpanId.

@Test
public void testAcceptPayloadGetSpanId() throws Exception {
    EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
    try {
        DistributedTracePayloadImpl distributedTracePayload = getDistributedTracePayload();
        // We don't care about the DT payload transaction, so we will harvest and clear the tx list before continuing
        harvestAndCheckTxn(holder);
        TransactionDataList transactionList = holder.getTransactionList();
        transactionList.clear();
        String spanId = startTxAcceptPayloadAndReturnSpanId(distributedTracePayload);
        harvestAndCheckTxn(holder);
        Tracer rootTracer = transactionList.get(0).getRootTracer();
        String expectedGuid = rootTracer.getGuid();
        assertEquals(expectedGuid, spanId);
    } finally {
        holder.close();
    }
}
Also used : TransactionDataList(com.newrelic.agent.TransactionDataList) Tracer(com.newrelic.agent.tracers.Tracer) DistributedTracePayloadImpl(com.newrelic.agent.tracing.DistributedTracePayloadImpl) Test(org.junit.Test)

Example 67 with TransactionDataList

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

the class TraceAccessorApiTest method harvestAndCheckTxn.

private void harvestAndCheckTxn(EnvironmentHolder holder) throws InterruptedException {
    TransactionDataList transactionList = holder.getTransactionList();
    ServiceFactory.getHarvestService().harvestNow();
    transactionList.waitFor(1, TimeUnit.SECONDS.toMillis(30));
    assertEquals(1, transactionList.size());
}
Also used : TransactionDataList(com.newrelic.agent.TransactionDataList)

Example 68 with TransactionDataList

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

the class TraceAccessorApiTest method testDistributedTracingEnabledGetSpanId.

@Test
public void testDistributedTracingEnabledGetSpanId() throws Exception {
    EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
    try {
        String spanId = startTxAndReturnSpanId();
        harvestAndCheckTxn(holder);
        TransactionDataList transactionList = holder.getTransactionList();
        Tracer rootTracer = transactionList.get(0).getRootTracer();
        String expectedGuid = rootTracer.getGuid();
        assertEquals(expectedGuid, spanId);
    } finally {
        holder.close();
    }
}
Also used : TransactionDataList(com.newrelic.agent.TransactionDataList) Tracer(com.newrelic.agent.tracers.Tracer) Test(org.junit.Test)

Example 69 with TransactionDataList

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

the class TraceAccessorApiTest method testSegmentGetSpanId.

@Test
public void testSegmentGetSpanId() throws Exception {
    EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
    try {
        String spanId = startSegmentAndReturnSpanId();
        harvestAndCheckTxn(holder);
        TransactionDataList transactionList = holder.getTransactionList();
        Tracer rootTracer = transactionList.get(0).getRootTracer();
        String expectedGuid = rootTracer.getGuid();
        assertEquals(expectedGuid, spanId);
    } finally {
        holder.close();
    }
}
Also used : TransactionDataList(com.newrelic.agent.TransactionDataList) Tracer(com.newrelic.agent.tracers.Tracer) Test(org.junit.Test)

Example 70 with TransactionDataList

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

the class TraceAccessorApiTest method testCreatePayloadGetSpanId.

@Test
public void testCreatePayloadGetSpanId() throws Exception {
    EnvironmentHolder holder = setupEnvironemntHolder("all_enabled_test");
    try {
        String spanId = startTxCreatePayloadAndReturnSpanId();
        harvestAndCheckTxn(holder);
        TransactionDataList transactionList = holder.getTransactionList();
        Tracer rootTracer = transactionList.get(0).getRootTracer();
        String expectedGuid = rootTracer.getGuid();
        assertEquals(expectedGuid, spanId);
    } finally {
        holder.close();
    }
}
Also used : TransactionDataList(com.newrelic.agent.TransactionDataList) Tracer(com.newrelic.agent.tracers.Tracer) Test(org.junit.Test)

Aggregations

TransactionDataList (com.newrelic.agent.TransactionDataList)70 Test (org.junit.Test)69 TransactionData (com.newrelic.agent.TransactionData)46 StatsEngine (com.newrelic.agent.stats.StatsEngine)36 Java7IncompatibleTest (com.newrelic.test.marker.Java7IncompatibleTest)12 Tracer (com.newrelic.agent.tracers.Tracer)11 HttpServletResponse (javax.servlet.http.HttpServletResponse)8 Transaction (com.newrelic.agent.Transaction)6 BrowserConfigTest (com.newrelic.agent.browser.BrowserConfigTest)6 ClassMethodSignature (com.newrelic.agent.tracers.ClassMethodSignature)6 OtherRootTracer (com.newrelic.agent.tracers.OtherRootTracer)6 SimpleMetricNameFormat (com.newrelic.agent.tracers.metricname.SimpleMetricNameFormat)6 MockHttpRequest (com.newrelic.agent.tracers.servlet.MockHttpRequest)5 MockHttpResponse (com.newrelic.agent.tracers.servlet.MockHttpResponse)5 ExtendedRequest (com.newrelic.api.agent.ExtendedRequest)5 Request (com.newrelic.api.agent.Request)5 Response (com.newrelic.api.agent.Response)5 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)5 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)5 MockHttpServletRequest (org.apache.struts.mock.MockHttpServletRequest)5